Skip to content

Methods to read / write secure container blobs to a file.

License

Notifications You must be signed in to change notification settings

alvignes/seco-file

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

44 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

seco-file

Install

npm i --save seco-file

Usage

// 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 to
  • data (String | Buffer) Data to write to the file
  • options (Object)
    • header (Object)
      • appName (String) Name of your app
      • appVersion (String) Version of your app
    • passphrase (String | Buffer) Passphrase used to encrypt the data
    • metadata (Object)
    • blobKey (Buffer)
    • overwrite (Boolean) When true, overwrites file if it already exists. Default is false.

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 read
  • passphrase (String | Buffer) Passphrase to decrypt the file.

Returns a Promise, resolving to an object that contains:

  • data (Buffer) The file data
  • header (Object) The header for the secure-container
  • blobKey (Buffer)
  • metadata (Object)

License

MIT

About

Methods to read / write secure container blobs to a file.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%