# stamptime

> get, set and reset when a script/function was last executed

Latest version **3.0.4** (published 2022-03-07) · MIT license · 0 weekly downloads

## Install

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

## Health

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

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 3.0.4 |
| Published | 2022-03-07 |
| First published | 2021-02-16 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 16.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Paul Browne |
| Maintainers | paul-browne |

## Links

- npm: https://www.npmjs.com/package/stamptime
- Repository: https://github.com/Paul-Browne/npm-last-ran
- Homepage: https://github.com/Paul-Browne/npm-last-ran#readme
- Issues: https://github.com/Paul-Browne/npm-last-ran/issues
- npm.io page: https://npm.io/package/stamptime

## Recent versions

- 3.0.4 (latest) — 2022-03-07
- 3.0.3 — 2022-03-07
- 3.0.2 — 2022-03-07
- 3.0.1 — 2021-10-20
- 3.0.0 — 2021-10-20
- 2.1.0 — 2021-10-19
- 2.0.4 — 2021-10-13
- 2.0.3 — 2021-10-13
- 2.0.2 — 2021-10-13
- 2.0.1 — 2021-10-13
- 2.0.0 — 2021-10-13
- 1.0.10 — 2021-10-13
- 1.0.9 — 2021-10-13
- 1.0.8 — 2021-10-13
- 1.0.7 — 2021-02-17
- … 6 more at https://npm.io/package/stamptime/versions

## README

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

### usage

`npm i stamptime`

or 

`npm i -D stamptime`


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

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