Socket
Socket
Sign inDemoInstall

timedfile

Package Overview
Dependencies
5
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    timedfile

Timed File - versioning with files


Version published
Maintainers
1
Install size
1.58 MB
Created

Readme

Source

build status npm version npm downloads npm downloads

TimedFile

If you need a single file to be versioned, this wrapper for you.

Features

You can save, rollback, fastforward, reset and clean

  • save to create a version on the timeline which you rollback, fastforward or reset to.
  • rollback to go back to a version which you have saved before
  • fastforward to fast forward to a version during a rollback
  • reset to remove all existing changes to the current version on the timeline (not always the latest)
  • clean to remove all existing versioning data (including commits and rollbacks), as good a new timedfile.
  • diff shows the content difference between modified text and current saved state
  • diffs shows a timeline of all the changes in diff format from npm-diff

Basic Usage

Examples of how to use the wrapper - Using Async/Await

For more usage examples, you can refer to the full documentation unit tests

To Save
const timedFile = new TimedFile({fileFullPath: 'PathToFile'});

Here is where you write something to the file

fs.appendFileSync(pathToFile, 'Some New Line');
  • Saving
await timedFile.save(author);
To Rollback
const timedFile = new TimedFile({fileFullPath: 'PathToFile'});

Here is where you write and save to the file a few times.

fs.appendFileSync(pathToFile, 'Some Line');
await timedFile.save(author);
fs.appendFileSync(pathToFile, 'Some Line Again');
await timedFile.save(author);
  • Rollback
await timedFile.rollback();

It rollbacks to a version without the last entry of Some Line Again

To FastForward

Continuing from the Rollback scenario

  • Fastforward
await timedFile.fastforward();

It rollbacks to a version with the last entry of Some Line Again

To Reset

Regardless of the contents in the file,

  • Reset
await timedFile.reset();
  • Clean
await timedFile.clean();
To Diff
  • Diff
await timedFile.diff();
  • Diffs
await timedFile.diffs();

FAQs

Last updated on 11 Dec 2016

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc