https://github.com/exodusmovement/seco-file
Methods to read / write secure container blobs to a file.
https://github.com/exodusmovement/seco-file
Last synced: about 1 year ago
JSON representation
Methods to read / write secure container blobs to a file.
- Host: GitHub
- URL: https://github.com/exodusmovement/seco-file
- Owner: ExodusMovement
- License: mit
- Created: 2016-06-22T21:01:06.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2024-01-30T16:34:22.000Z (over 2 years ago)
- Last Synced: 2024-04-14T13:10:04.297Z (about 2 years ago)
- Language: JavaScript
- Size: 39.1 KB
- Stars: 8
- Watchers: 31
- Forks: 5
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
- Codeowners: .github/CODEOWNERS
Awesome Lists containing this project
README
seco-file
=========
Install
-------
npm i --save seco-file
Usage
-----
```js
// 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