@zingle/redisdrop
v0.0.1
Published
drop files into redis list
Downloads
3
Keywords
Readme
Redis Dropbox: redisdrop
Create a function to drop files into a Redis list.
Example
const fs = require("fs");
const s3drop = require("redisdrop");
const endpoint = "redis://localhost:6379";
const keyspace = "dropbox:";
const filename = "my-file.txt";
const sender = "jdoe";
const keyfield = "sender"
const file = fs.createReadStream(filename);
// create drop function for redis list
const drop = redisdrop(endpoint, {keyspace, keyfield});
// set arbitrary metadata
const metadata = {filename, sender};
// use drop function to store file to S3
drop(file, metadata).then(key => {
console.log(`saved attachment to '${key}' list at endpoint ${endpoint}`);
}).catch(err => {
console.error(err.message);
});