# scratch

> Scratch memory

Latest version **0.0.0** (published 2013-05-11) · MIT license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

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

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 0.0.0 |
| Published | 2013-05-11 |
| First published | 2013-05-11 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Mikola Lysenko |
| Maintainers | mikolalysenko |
| Keywords | scratch, typed, array, memory, cache, hot, allocation, garbage, collector, temporary, optimization |

## Links

- npm: https://www.npmjs.com/package/scratch
- Repository: https://github.com/mikolalysenko/scratch
- npm.io page: https://npm.io/package/scratch

## Dependencies (1)

- [bit-twiddle](https://npm.io/package/bit-twiddle.md) ~0.0.2

## Alternatives

- [memory-cache](https://npm.io/package/memory-cache.md) — 795.0K weekly downloads
- [@httptoolkit/proxy-agent](https://npm.io/package/@httptoolkit/proxy-agent.md) — 11.2K weekly downloads
- [express-cache-controller](https://npm.io/package/express-cache-controller.md) — 5.3K weekly downloads
- [http-cache-middleware](https://npm.io/package/http-cache-middleware.md) — 4.5K weekly downloads
- [cache2](https://npm.io/package/cache2.md) — 1.5K weekly downloads

## Recent versions

- 0.0.0 (latest) — 2013-05-11

## README

scratch
=======
Reuse scratch memory for intermediate calculations.  This is useful for avoiding costly reallocations and for keeping temporary array data in hot cache between procedure calls.

## Install

    npm install scratch

### `require("scratch")(n[, dtype])`
Returns a temporary array buffer for intermediate calculations.

* `n` is the length of the array
* `dtype` is an optional string which specifies the type of the typed array to return.  Possible options are:
    + `"uint8"`
    + `"uint16"`
    + `"uint32"`
    + `"int8"`
    + `"int16"`
    + `"int32"`
    + `"float32"`
    + `"float64"`
    + `undefined` - Returns an ArrayBuffer

**Returns** A typed array of length `n`

## Warning
This module is non-reentrant.  Once you have allocated scratch memory, you should not call any submodules, or else they may overwrite the contents of the data in scratch.  You should only use this module if you know what you are doing.

# Credits
(c) 2013 Mikola Lysenko. MIT License

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