New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

hapi-darwin

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hapi-darwin

image storage

  • 1.0.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2
Maintainers
1
Weekly downloads
 
Created
Source

hapi-darwin

image storage

Dependency Status devDependency Status Build Status

Install

$ npm install hapi-darwin

Usage

    server.route({
        method: 'POST',
        path: '/upload',
        config: {
            payload: {
                maxBytes: 1110.5 * 1024 * 1024, // 500KB
                output: 'stream',
                allow: 'multipart/form-data' // important
            },
            cors: {
                origin: ['*'],
                credentials: true,
                additionalHeaders: ['content-type']
            }
        },
        handler: async function (request, reply) {

            try {
                const uploader = request.server.plugins['hapi-darwin'].uploader;

                const data = request.payload;
                const file = data['avatar'];

                const fileName = `${Date.now()}-drwin`;

                const fileOptions = {
                    name: fileName,
                    destination: './public/storage/course'
                }

                const result = await uploader(file, fileOptions);

                reply(result);

            } catch (err) {
                
                reply(Boom.badRequest(err.message, err));
            }

        }
    });

License

MIT

FAQs

Package last updated on 03 Dec 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc