# seekable

> Allows for random seeking and buffered reading in a simple-stream of binary data.

Latest version **0.1.2** (published 2013-07-10) · MIT license · 0 weekly downloads

## Install

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

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.2 |
| Published | 2013-07-10 |
| First published | 2013-07-10 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 4 |
| Author | Tim Caswell |
| Maintainers | creationix |
| Keywords | simple-stream, seek, binary, jsgit |

## Links

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

## Dependencies (1)

- [bops](https://npm.io/package/bops.md) ~0.0.6

## Alternatives

- [byte-size](https://npm.io/package/byte-size.md) — 2.1M weekly downloads
- [speed-limiter](https://npm.io/package/speed-limiter.md) — 16.0K weekly downloads
- [@powersync/node](https://npm.io/package/@powersync/node.md) — 10.9K weekly downloads
- [@ledgerhq/coin-cardano](https://npm.io/package/@ledgerhq/coin-cardano.md) — 1.0K weekly downloads
- [@jayesol/jayeson.lib.streamfinder](https://npm.io/package/@jayesol/jayeson.lib.streamfinder.md) — 1.0K weekly downloads

## Recent versions

- 0.1.2 (latest) — 2013-07-10
- 0.1.1 — 2013-07-10
- 0.1.0 — 2013-07-10
- 0.0.2 — 2013-07-10
- 0.0.1 — 2013-07-10

## README

seekable
========

Allows for forward seeking and buffered reading in a simple-stream of binary data.

### seekable(getStream) -> seek

Create a `seek` function from a stream object.

The `getStream` function allows seekable to get a new stream from you when it needs to rewind and start over.  It may be called more than once.  Make sure to pass in a new stream each time.

```js
var seekable = require('seekable');

var seek = seekable(function (callback) {
  // Create a stream for the thing you want to read from
  // This may be called multiple times if you ever seek backwards.
  callback(null, makeMyStream());
});
```

### seek(offset, bytes) continuable&lt;data>

Seek to position `offset` and consume `bytes` calling the continuable's `callback(err, data)` when done.

Note that if you seek to a position that's already been read and discarded in the current source, it will ask you for another one to start over.

```js
seek(100, 100)(function (err, chunk) {
  // I now have 100 bytes as position 100.
});
```

## License

The MIT License (MIT)

Copyright (c) 2013 Tim Caswell

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

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