Skip to content

junglejs/jungle-middleware-download

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

jungle-middleware-download

Download files to junglejs.

Configuration

/* jungle.config.js */

const middlewareDownload = require('jungle-middleware-download');

module.exports = async () => {
    const jungleGateway = junglePreProcess({
        gateways: {
            anyGraphQLGateway
        },
        middlewareContext: {
            anyGraphQLGateway: {
                Assets: async (data) => {
                    if (!data.fileName) return;
                    const loaded = await middlewareDownload({
                        destination: 'assets',
                        url: data.url, // Source URL
                        filename: data.fileName // Used filename locally
                    });
                    data.url = url;

                    // In your .svelte file:
                    <img src={QUERYRES.assets[0].url} />
                }
            } 
        }
    });
};

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published