How to use webiny-file-storage-local - 4 common examples

To help you get started, we’ve selected a few webiny-file-storage-local examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github webiny / webiny-js / examples / api / src / import / users / import.js View on Github external
export default async () => {
    Entity.driver = new MySQLDriver({ connection });

    const authentication = new Authentication({
        identities: [{ identity: User }]
    });

    // Configure default storage
    const localDriver = new LocalDriver({
        directory: __dirname + "/storage",
        createDatePrefix: false,
        publicUrl: "https://cdn.domain.com"
    });

    const storage = new Storage(localDriver);

    // Register attributes
    registerSecurityAttributes(authentication);
    registerBufferAttribute();
    registerFileAttributes({ entity: File, storage });
    registerImageAttributes({ entity: Image });

    console.log("Importing data...");
    for (let i = 0; i < importData.length; i++) {
        const { entity, data } = await importData[i]();
github webiny / webiny-js / examples / api / src / import / users / import.js View on Github external
export default async () => {
    Entity.driver = new MySQLDriver({ connection });

    const authentication = new Authentication({
        identities: [{ identity: User }]
    });

    // Configure default storage
    const localDriver = new LocalDriver({
        directory: __dirname + "/storage",
        createDatePrefix: false,
        publicUrl: "https://cdn.domain.com"
    });

    const storage = new Storage(localDriver);

    // Register attributes
    registerSecurityAttributes(authentication);
    registerBufferAttribute();
    registerFileAttributes({ entity: File, storage });
    registerImageAttributes({ entity: Image });

    console.log("Importing data...");
    for (let i = 0; i < importData.length; i++) {
        const { entity, data } = await importData[i]();
github webiny / webiny-js / examples / api / src / configs / middleware.js View on Github external
export default () => {
    // Configure default storage
    const localDriver = new LocalDriver({
        directory: __dirname + "/storage",
        createDatePrefix: false,
        publicUrl: "https://cdn.domain.com"
    });

    return middleware({
        // Configure middleware for request processing
        use: [
            // First try authenticating the client using the token.
            authenticationMiddleware({ token: "Authorization" }),
            // Process request
            endpointMiddleware({
                // Check authorization before executing matched API method
                beforeApiMethod: [authorizationMiddleware()]
            })
        ],
github webiny / webiny-js / examples / cloud-api / src / app / middleware.js View on Github external
export default async () => {
    // Configure default storage
    const localDriver = new LocalDriver({
        directory: __dirname + "/../../storage",
        createDatePrefix: false,
        publicUrl: "http://localhost:9000/storage/"
    });

    api.configure({
        database: { connection },
        entity: {
            // Instantiate driver with DB connection
            driver: new MySQLDriver({ connection }),
            // Configure entity attributes
            attributes: ({
                /*                passwordAttribute,
                identityAttribute,
                bufferAttribute,*/
                fileAttributes,

webiny-file-storage-local

Local file-system storage driver for webiny-file-storage library

MIT
Latest version published 6 years ago

Package Health Score

60 / 100
Full package analysis

Popular webiny-file-storage-local functions

Similar packages