3.0.4 • Published 3 years ago

stamptime v3.0.4

Weekly downloads
11
License
MIT
Repository
github
Last release
3 years ago

stamptime

get and set a timestamp of when a script/function was last executed.

usage

npm i stamptime

or

npm i -D stamptime

import { get, set, reset } from "stamptime"

// sets a timestamp with an id of "evt8ex"
set("evt8ex");

// gets the time stamp with an id of "evt8ex"
const time = await get("evt8ex");

// resets the time stamp with an id of "evt8ex"
reset("evt8ex");

if doing get(id) before set(id) the result will be 0, and a set(id) call will be made.

How does it work?

stamptime uses file creation/modification time as a time eg. set("evt8ex") will create an empty file named "evt8ex" in the node_modules/stampfile/ directory. Then get("evt8ex") uses stat to return the time the file was created (or modified if it already existed).

This works very quickly since the file system doesn't need to read the file using readFile rather just the mtimeMs (last modified time) from the stat method.

3.0.4

3 years ago

3.0.3

3 years ago

3.0.2

3 years ago

3.0.1

4 years ago

1.0.9

4 years ago

1.0.8

4 years ago

3.0.0

4 years ago

2.0.3

4 years ago

2.0.2

4 years ago

2.0.4

4 years ago

1.0.10

4 years ago

2.1.0

4 years ago

2.0.1

4 years ago

2.0.0

4 years ago

1.0.7

4 years ago

1.0.6

4 years ago

1.0.2

4 years ago

1.0.5

4 years ago

1.0.4

4 years ago

1.0.3

4 years ago

1.0.0

4 years ago