filedump
Store files, buffers or readble streams in the filesystem with an automatically generated random filename and divided in folders to circument file system limitations.
Install
npm install filedump
Usage
var filedump = "/path/to/storage" 20;/* file in the filesystem */filedump;/* buffer */filedump;/* readble stream */var rs = ;filedump;
API
filedump(path, len)
path
points to the folder where the files are storedlen
is the length of the random generated string the directories and file name is derived from
filedump.save(data, [ext], callback)
Save data and call back with filename when file is written
data
can be a file path, buffer or readble streamext
is the file extention for the generated file. this is automatically determined when the first argument is a file pathcallback
haserr
andfilename
as arguments
filedump.dump(data, [ext], callback)
Save data and call back with filename before file is written and without error reporting
data
can be a file path, buffer or readble streamext
is the file extention for the generated file. this is automatically determined when the first argument is a file pathcallback
haserr
andfilename
as arguments
filedump.prepare([ext], callback)
Generate random file name, create directories and call back with file name
ext
is the file extention for the generated file. this is automatically determined when the first argument is a file pathcallback
haserr
andfilename
as arguments
filedump.delete(file, callback)
Delete a file and clear its parent directories.
file
is the file name relative to the storage foldercallback
haserr
as an argument