express-camo

0.0.9 • Public • Published

express-camo

Save remote files to local directory, send it to clients

NPM version Build Status

Serve file with nginx internal request with X-Accel-Redirect header

server {
    listen 80;
    server_name file.localhost;
    location / {
        proxy_pass http://127.0.0.1:3000;
    }
    location /camo {
        internal;
        alias /you/path/to/express-camo/tmp;
        break;
    }
}

Options

tmpDir: path.join __dirname, '../tmp'   # Save files to the tmp directory, this will also be the nginx alias property
expire: 86400000                        # Save the file for the expire milliseconds
urlPrefix: '/camo'                      # The url prefix in nginx location block
getUrl: (req) -> req.query.url          # Get url param by your way
store:                                  # Define your store or use the default redis store (every store should have  getMime/setMime function)

Package Sidebar

Install

npm i express-camo

Weekly Downloads

4

Version

0.0.9

License

MIT

Last publish

Collaborators

  • sailxjx