Gathering detailed insights and metrics for rollback
Gathering detailed insights and metrics for rollback
Gathering detailed insights and metrics for rollback
Gathering detailed insights and metrics for rollback
npm install rollback
Typescript
Module System
Min. Node Version
Node Version
NPM Version
TypeScript (97.39%)
JavaScript (2.61%)
Total Downloads
5,468
Last Day
1
Last Week
3
Last Month
15
Last Year
544
4 Stars
370 Commits
1 Forks
3 Watching
26 Branches
2 Contributors
Minified
Minified + Gzipped
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
Cumulative downloads
Total Downloads
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
Rollback the rock!
Undo pesky file system mutations with ease.
npm i -s rollback
Both typescript and javascript support come out of the box.
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});
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();
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.
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.
Licensed under MIT
No vulnerabilities found.
Reason
security policy file detected
Details
Reason
no binaries found in the repo
Reason
license file detected
Details
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
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
37 existing vulnerabilities detected
Details
Score
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