# timedfile

> Timed File - versioning with files

Latest version **1.5.4** (published 2016-12-11) · MIT license · 0 weekly downloads

## Install

```sh
npm install timedfile
pnpm add timedfile
yarn add timedfile
bun add timedfile
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.5.4 |
| Published | 2016-12-11 |
| First published | 2016-12-06 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 5 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2 |
| Author | Raymond Ho |
| Maintainers | chunkiat82 |

## Links

- npm: https://www.npmjs.com/package/timedfile
- Repository: https://github.com/chunkiat82/timedfile
- Issues: https://github.com/chunkiat82/timedfile/issues
- npm.io page: https://npm.io/package/timedfile

## Dependencies (5)

- [diff](https://npm.io/package/diff.md) ^3.1.0
- [debug](https://npm.io/package/debug.md) ^2.3.3
- [mkdirp](https://npm.io/package/mkdirp.md) ^0.5.1
- [fs-extra](https://npm.io/package/fs-extra.md) ^1.0.0
- [git-node](https://npm.io/package/git-node.md) ^0.1.1

## Recent versions

- 1.5.4 (latest) — 2016-12-11
- 1.5.3 — 2016-12-10
- 1.5.2 — 2016-12-09
- 1.5.1 — 2016-12-09
- 1.5.0 — 2016-12-09
- 1.4.0 — 2016-12-09
- 1.3.1 — 2016-12-08
- 1.3.0 — 2016-12-08
- 1.2.0 — 2016-12-08
- 1.1.2 — 2016-12-07
- 1.1.1 — 2016-12-07
- 1.1.0 — 2016-12-07
- 1.0.0 — 2016-12-06
- 0.1.0 — 2016-12-06
- 0.0.1 — 2016-12-06

## README

[![build status](https://img.shields.io/travis/chunkiat82/timedfile/master.svg?style=flat-square)](https://travis-ci.org/chunkiat82/timedfile)
[![npm version](https://img.shields.io/npm/v/timedfile.svg?style=flat-square)](https://www.npmjs.com/package/timedfile)
[![npm downloads](https://img.shields.io/npm/dm/timedfile.svg?style=flat-square)](https://www.npmjs.com/package/timedfile)
[![npm downloads](https://img.shields.io/coveralls/chunkiat82/timedfile/master.svg?style=flat-square)](https://coveralls.io/github/chunkiat82/timedfile)
# 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](https://github.com/kpdecker/jsdiff)

## 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
```js
const timedFile = new TimedFile({fileFullPath: 'PathToFile'});
```
Here is where you write something to the file 
```js
fs.appendFileSync(pathToFile, 'Some New Line');
```
* Saving

```js
await timedFile.save(author);
```

#### To Rollback

```js
const timedFile = new TimedFile({fileFullPath: 'PathToFile'});
```
Here is where you write and save to the file a few times.

```js
fs.appendFileSync(pathToFile, 'Some Line');
await timedFile.save(author);
fs.appendFileSync(pathToFile, 'Some Line Again');
await timedFile.save(author);
```
* Rollback

```js
await timedFile.rollback();
```
It rollbacks to a version without the last entry of `Some Line Again`

#### To FastForward

*Continuing from the Rollback scenario*

* Fastforward 

```js
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

```js
await timedFile.reset();
```

* Clean

```js
await timedFile.clean();
```

#### To Diff
* Diff

```js
await timedFile.diff();
```

* Diffs

```js
await timedFile.diffs();
```

---
_Source: https://npm.io/package/timedfile · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
