# jsonbank

> Official Jsonbank Node Package.

Latest version **1.6.2** (published 2026-08-27) · MIT license · 0 weekly downloads

## Install

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

## Health

**Score 65/100 (B)** — status: active.

Positive: has types; no vulnerabilities; recently updated; high maintenance score; high quality score.

Warnings: low downloads; no esm support.

## Facts

| | |
|---|---|
| Version | 1.6.2 |
| Published | 2026-08-27 |
| First published | 2021-07-18 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 48.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 3 |
| Author | jsonbankio |
| Maintainers | trapcode |
| Keywords | jsonbank, json, bank, api, node, typescript |

## Links

- npm: https://www.npmjs.com/package/jsonbank
- Repository: https://github.com/jsonbankio/jsonbank-js
- Homepage: https://github.com/jsonbankio/jsonbank-js#readme
- Issues: https://github.com/jsonbankio/jsonbank-js/issues
- npm.io page: https://npm.io/package/jsonbank

## Dependencies (2)

- [axios](https://npm.io/package/axios.md) ^1.3.5
- [object-collection](https://npm.io/package/object-collection.md) ^3.0.1

## Alternatives

- [@mapbox/jsonlint-lines-primitives](https://npm.io/package/@mapbox/jsonlint-lines-primitives.md) — 5.3M weekly downloads
- [reftools](https://npm.io/package/reftools.md) — 3.5M weekly downloads
- [@hey-api/openapi-ts](https://npm.io/package/@hey-api/openapi-ts.md) — 3.5M weekly downloads
- [@mapbox/geojson-rewind](https://npm.io/package/@mapbox/geojson-rewind.md) — 2.4M weekly downloads
- [turbo-stream](https://npm.io/package/turbo-stream.md) — 1.7M weekly downloads

## Recent versions

- 1.6.2 (latest) — 2026-08-27
- 1.6.1 (next) — 2026-06-01
- 1.6.0 — 2026-06-01
- 1.5.4 — 2026-06-01
- 1.5.3 — 2024-01-31
- 1.5.2 — 2023-10-31
- 1.5.1 — 2023-10-30
- 1.5.0 — 2023-04-21
- 1.4.5 — 2023-04-19
- 1.4.4 — 2023-04-19
- 1.4.2 — 2023-04-17
- 1.4.1 — 2022-11-02
- 1.4.0 — 2022-11-02
- 1.3.1 — 2022-11-01
- 1.3.0 — 2022-10-26
- … 18 more at https://npm.io/package/jsonbank/versions

## README

# JsonBank NodeJs SDK

The official repository for [jsonbank.io](https://jsonbank.io) Javascript SDK.
##### STAGE: (RFC)

## Installation
```shell
npm i jsonbank
# OR YARN
yarn add jsonbank
```

## Usage
```javascript
const {JsonBank} = require("jsonbank")

// Initialize with Api keys.
const jsb = new JsonBank({
  keys: {
    pub: 'JSB_PUBLIC_KEY',
    prv: 'JSB_PRIVATE_KEY',
  }
});

// Get json content of a public file.
await jsb.getContent("public/my.json");

// Get json content of a private file
await jsb.getOwnContent("private/my.json");

// Get a json file from github.
await jsb.getGithubContent("github_username/repo/path/to/my.json");

// Update content of a json file.
await jsb.updateContent('private/numbers.json', {
  // new data...
})
```

### Listing

List what's inside a project, one level deep. All three take a project slug and an optional
params object. Pass `folder` (a folder id or its path) to list inside a folder instead of the
project root.

```javascript
// Documents and folders together. The two lists paginate independently.
const {project, documents, folders} = await jsb.scanProject("my-project");

// Scoped to a folder, by path or by id.
await jsb.scanProject("my-project", {folder: "locales"});

// Only one of the lists, so nothing you don't need is queried or paged.
await jsb.listDocuments("my-project", {page: 2, perPage: 50});
await jsb.listFolders("my-project", {sort: "createdAt", order: "desc"});
```

`sort` is one of `name` (default), `createdAt` or `updatedAt`, and `order` is `asc` (default) or
`desc`. `perPage` defaults to 100 and goes up to 1000.

Each list is a page of results, so walk `meta.lastPage` to get everything:

```javascript
let page = 1, lastPage = 1;

do {
  const {documents} = await jsb.listDocuments("my-project", {page, perPage: 1000});
  lastPage = documents.meta.lastPage;

  for (const doc of documents.data) {
    // documents are metadata only, fetch content separately
    console.log(doc.path, doc.contentSize.string);
  }
} while (page++ < lastPage);
```


## Testing
Create an .env file in the root of the project and add the following variables

```dotenv
JSB_HOST="https://api.jsonbank.io"
JSB_TIMEOUT=30000
JSB_PUBLIC_KEY="your public key"
JSB_PRIVATE_KEY="your private key"
```

Then run the test command below.

```bash
npm run test
```

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