Digital Ocean Space adapter for receiving upstreams. Particularly useful for handling streaming multipart file uploads from the Skipper body parser.
Comes equip with image compression using sharp
$ install as npm-github dependency
Also make sure you have skipper itself installed as your body parser. This is the default configuration in Sails as of v0.10.
an object containing parameters to authenticate to digital ocean.
| Option | Type | Required | Default |
|---|---|---|---|
| endpoint | string | Y | sgp1.digitaloceanspaces.com |
| bucket | string | Y | null |
| key | string | Y | null |
| secret | string | Y | null |
an object containing parameters to compress images
| Option | Type | Required | Default |
|---|---|---|---|
| enabled | boolean | N | false |
| width | number (px) | N | 500 |
| height | number (px) | N | null |
req.file('avatar')
.upload({
// Required
adapter: require("skipper-do-space"),
space: {
endpoint: "sgp1.digitaloceanspaces.com",
bucket: "test-bucket",
key: "example-key",
secret: "example-secret"
},
compress: {
enabled: true,
width: 600,
height: null
}
}, function (err, result) {
//do whatever in the callback
});