Dropbox storage adapter for keystonejs
Usage
Configure the storage adapter:
var storage = new keystone.Storage({
adapter: require('keystone-storage-adapter-dropbox'),
dropbox: {
accessToken: process.env.DROPBOX_ACCESS_TOKEN,
path: process.env.DROPBOX_PATH + '/uploads',
},
path: process.env.DROPBOX_PATH + '/uploads',
schema: {
filename: true,
path_display: true,
path: true,
id: true,
url: true,
originalname: true,
},
});
Then use it as the storage provider for a File field:
File.add({
name: { type: String },
file: { type: Types.File, storage: storage },
});
Options:
The adapter requires an additional s3
field added to the storage options. It accepts the following values:
Tips
-
Delete file from dropbox if delete from db
Documents.schema.post('remove', async function (doc) {
return storage.removeFile(doc.file, () => {
});
});
License
Licensed under the standard MIT license. See LICENSE.