2.0.0 • Published 2 years ago
seco-file v2.0.0
seco-file
Install
npm i --save seco-fileUsage
// ES6 modules:
import * as seco from 'seco-file'
// OR
// CommonJS:
const seco = require('seco-file')write()
write(file, data, options)
file(String) Filename to write todata(String | Buffer) Data to write to the fileoptions(Object)header(Object)appName(String) Name of your appappVersion(String) Version of your app
passphrase(String | Buffer) Passphrase used to encrypt the datametadata(Object)blobKey(Buffer)overwrite(Boolean) Whentrue, overwritesfileif it already exists. Default isfalse.
Note: Must set either passphrase or metadata & blobKey.
Returns a Promise. Promise resolves to an Object that contains blobKey and metadata.
read()
read(file, passphrase)
file(String) File to readpassphrase(String | Buffer) Passphrase to decrypt the file.
Returns a Promise, resolving to an object that contains:
data(Buffer) The file dataheader(Object) The header for the secure-containerblobKey(Buffer)metadata(Object)
License
MIT