sugo-endpoint-zip

1.0.4 • Public • Published

sugo-endpoint-zip

Build Status npm Version JS Standard

Endpoint to download files as zip

Requirements

Node.js NPM

Installation

$ npm install sugo-endpoint-zip --save

Usage

Create an instance and apply to sg-server (or sugo-cloud)

/** This is an example to use sugo-endpoint-zip */
 
'use strict'
 
const sgServer = require('sg-server')
 
const server = sgServer({
  middlewares: [
    /* ... */
  ],
  endpoints: {
    'download/:filename': require('sugo-endpoint-zip')({
      // Options
    })
  }
})
 
server.listen(3000)
 
 

Then call the api from agent script.

/** This is example of client */
 
'use strict'
 
const sugoAgentZip = require('sugo-agent-zip')
const co = require('co')
 
co(function * () {
  let agent = sugoAgentZip('/downloads')
  let knocked = yield agent.knock()
  /* .. */
 
  // Download the zip and save to file.
  yield agent.download('photos', 'tmp/downloads/photos.zip')
}).catch((err) => console.error(err))
 

Signature

sugoEndpointZip(options) -> function

Endpoint to download files as zip

Args
Name Type Default Description
options object Optional settings.

License

This software is released under the Apache-2.0 License.

Links

Readme

Keywords

Package Sidebar

Install

npm i sugo-endpoint-zip

Weekly Downloads

0

Version

1.0.4

License

Apache-2.0

Last publish

Collaborators

  • realglobe