Installations
npm install rollback
Developer Guide
Typescript
No
Module System
CommonJS
Min. Node Version
>=8
Node Version
10.20.1
NPM Version
6.14.4
Releases
Contributors
Unable to fetch Contributors
Languages
TypeScript (97.39%)
JavaScript (2.61%)
Developer
JustinLivi
Download Statistics
Total Downloads
5,468
Last Day
1
Last Week
3
Last Month
15
Last Year
544
GitHub Statistics
4 Stars
370 Commits
1 Forks
3 Watching
26 Branches
2 Contributors
Bundle Size
81.58 kB
Minified
25.28 kB
Minified + Gzipped
Package Meta Information
Latest Version
0.2.16
Package Id
rollback@0.2.16
Unpacked Size
77.37 kB
Size
17.47 kB
File Count
26
NPM Version
6.14.4
Node Version
10.20.1
Total Downloads
Cumulative downloads
Total Downloads
5,468
Last day
0%
1
Compared to previous day
Last week
-50%
3
Compared to previous week
Last month
-59.5%
15
Compared to previous month
Last year
-17.1%
544
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
Rollback
Rollback the rock!
Undo pesky file system mutations with ease.
Installation
npm i -s rollback
Both typescript and javascript support come out of the box.
Basic Usage
Asynchronous API
Take a snapshot of a directory.
1import { snapshot } from 'rollback'; 2import { writeFileSync } from 'fs'; 3 4snapshot({ 5 path: '/some/directory' 6}).then(snap => { 7 // make some changes 8 writeFileSync('/some/directory/myFile', 'some updates'); 9 // then rollback all the changes 10 return snap.rollback(); 11});
Take a snapshot of a file.
1import { snapshotFile } from 'rollback'; 2import { writeFileSync } from 'fs'; 3 4snapshotFile({ 5 path: '/some/file.txt' 6}).then(snap => { 7 // make some changes 8 writeFileSync('/some/file.txt', 'some updates'); 9 // then rollback all the changes 10 return snap.rollback(); 11});
Synchronous API
Take a snapshot of a directory.
1import { snapshotSync } from 'rollback'; 2import { writeFileSync } from 'fs'; 3 4const snap = snapshotSync({ 5 path: '/some/directory' 6}); 7writeFileSync('/some/directory/myFile', 'some updates'); 8snap.rollbackSync();
Take a snapshot of a file.
1import { snapshotFileSync } from 'rollback'; 2import { writeFileSync } from 'fs'; 3 4const snap = snapshotFileSync({ 5 path: '/some/file.txt' 6}); 7writeFileSync('/some/file.txt', 'some updates'); 8snap.rollbackSync();
Advanced Usage
Rollback exposes four base methods: snapshot
, snapshotSync
, snapshotFile
, and snapshotFileSync
.
All methods accept all configuration options exposed by tmp.
Additionally the following options from fs-extra's copy are supported:
preserveTimestamps, filter, recursive
(recursive
is only supported for snapshot
and snapshotSync
)
snapshot
and snapshotFile
return a Promise which resolves with a Snapshot
object.
snapshotSync
and snapshotFileSync
return a Snapshot
directly.
Snapshot
A Snapshot
object has the following properties:
property | type | description |
---|---|---|
path | string | the path of the temporary directory |
cleanup | () => void | manually cleans up the temporary directory |
rollback | (options?: RollbackOptions) => Promise<void> | asynchronously rolls back any changes to the snapshot |
rollbackSync | (options?: RollbackOptions) => void | synchronously rolls back any changes to the snapshot |
RollbackOptions
takes the following form:
1interface RollbackOptions { 2 preserveTimestamps?: boolean; 3 recursive?: boolean; // only supported if the snapshot is of a directory 4}
The default for rollback options is whatever was specified in the snapshot
, snapshotSync
, snapshotFile
, or snapshotFileSync
invocation that generated the Snapshot
object.
API Documentation
License
Licensed under MIT
No vulnerabilities found.
Reason
security policy file detected
Details
- Info: security policy file detected: SECURITY.md:1
- Info: Found linked content: SECURITY.md:1
- Info: Found disclosure, vulnerability, and/or timelines in security policy: SECURITY.md:1
- Info: Found text in security policy: SECURITY.md:1
Reason
no binaries found in the repo
Reason
license file detected
Details
- Info: project has a license file: LICENSE:0
- Info: FSF or OSI recognized license: MIT License: LICENSE:0
Reason
Found 13/14 approved changesets -- score normalized to 9
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
project is not fuzzed
Details
- Warn: no fuzzer integrations found
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
- Warn: 0 commits out of 29 are checked with a SAST tool
Reason
37 existing vulnerabilities detected
Details
- Warn: Project is vulnerable to: GHSA-67hx-6x53-jw92
- Warn: Project is vulnerable to: GHSA-v88g-cgmw-v5xw
- Warn: Project is vulnerable to: GHSA-93q8-gq69-wqmw
- Warn: Project is vulnerable to: GHSA-grv7-fg5c-xmjg
- Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275
- Warn: Project is vulnerable to: GHSA-gxpj-cx7g-858c
- Warn: Project is vulnerable to: GHSA-w573-4hg7-7wgq
- Warn: Project is vulnerable to: GHSA-ff7x-qrg7-qggm
- Warn: Project is vulnerable to: GHSA-765h-qjxv-5f44
- Warn: Project is vulnerable to: GHSA-f2jv-r9rf-7988
- Warn: Project is vulnerable to: GHSA-7wwv-vh3v-89cq
- Warn: Project is vulnerable to: GHSA-43f8-2h32-f4cj
- Warn: Project is vulnerable to: GHSA-896r-f27r-55mw
- Warn: Project is vulnerable to: GHSA-9c47-m6qq-7p4h
- Warn: Project is vulnerable to: GHSA-29mw-wpgm-hmr9
- Warn: Project is vulnerable to: GHSA-35jh-r3h4-6jhm
- Warn: Project is vulnerable to: GHSA-5v2h-r2cx-5xgj
- Warn: Project is vulnerable to: GHSA-rrrm-qjm4-v8hf
- Warn: Project is vulnerable to: GHSA-952p-6rrq-rcjv
- Warn: Project is vulnerable to: GHSA-f8q6-p94x-37v3
- Warn: Project is vulnerable to: GHSA-xvch-5gv4-984h
- Warn: Project is vulnerable to: GHSA-5fw9-fq32-wv5p
- Warn: Project is vulnerable to: GHSA-hj48-42vr-x3v9
- Warn: Project is vulnerable to: GHSA-hrpp-h998-j3pp
- Warn: Project is vulnerable to: GHSA-p8p7-x288-28g6
- Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw
- Warn: Project is vulnerable to: GHSA-4rq4-32rv-6wp6
- Warn: Project is vulnerable to: GHSA-64g7-mvw6-v9qj
- Warn: Project is vulnerable to: GHSA-jgrx-mgxx-jf9v
- Warn: Project is vulnerable to: GHSA-72xf-g2v4-qvf3
- Warn: Project is vulnerable to: GHSA-7p7h-4mm5-852v
- Warn: Project is vulnerable to: GHSA-38fc-wpqx-33j7
- Warn: Project is vulnerable to: GHSA-cf4h-3jhx-xvhq
- Warn: Project is vulnerable to: GHSA-j8xg-fqg3-53r7
- Warn: Project is vulnerable to: GHSA-6fc8-4gx4-v693
- Warn: Project is vulnerable to: GHSA-3h5v-q93c-6h6q
- Warn: Project is vulnerable to: GHSA-c4w7-xm78-47vh
Score
4.3
/10
Last Scanned on 2024-12-30
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More