# sqlite-to-json

> Dump data from sqlite databases to JSON files easily.

Latest version **0.1.3** (published 2017-03-16) · 0 weekly downloads

## Install

```sh
npm install sqlite-to-json
pnpm add sqlite-to-json
yarn add sqlite-to-json
bun add sqlite-to-json
```

## 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.3 |
| Published | 2017-03-16 |
| First published | 2014-07-16 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >= 0.8 |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 21 |
| Author | Tyler Kellen |
| Maintainers | alancnet, tkellen |
| Keywords | sqlite to json |

## Links

- npm: https://www.npmjs.com/package/sqlite-to-json
- Repository: https://github.com/tkellen/node-sqlite-to-json
- Issues: https://github.com/tkellen/node-sqlite-to-json/issues
- npm.io page: https://npm.io/package/sqlite-to-json

## Dependencies (1)

- [mkdirp](https://npm.io/package/mkdirp.md) ^0.5.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

- 0.1.3 (latest) — 2017-03-16
- 0.1.2 — 2015-02-25
- 0.1.1 — 2014-07-16

## README

# sqlite-to-json [![Build Status](https://secure.travis-ci.org/tkellen/node-sqlite-to-json.png)](http://travis-ci.org/tkellen/node-sqlite-to-json)
> Dump data from sqlite databases to JSON files easily.

[![NPM](https://nodei.co/npm/sqlite-to-json.png)](https://nodei.co/npm/sqlite-to-json/)

## API

### constructor(opts)

Create an instance of SqliteToJson.

Example:
```js
const SqliteToJson = require('sqlite-to-json');
const sqlite3 = require('sqlite3');
const exporter = new SqliteToJson({
  client: new sqlite3.Database('./mydb.sqlite3')
});
```

#### opts.client

A [sqlite3](https://github.com/mapbox/node-sqlite3) client instance.

Type: `sqlite3.Database`  
Default: `null`


### tables(cb)

List all tables in the current database.

Example:
```js
const SqliteToJson = require('sqlite-to-json');
const sqlite3 = require('sqlite3');
const exporter = new SqliteToJson({
  client: new sqlite3.Database('./mydb.sqlite3')
});
exporter.tables(function (err, tables) {
  // all your table names here
});
```

### save(table, dest, cb)

Save the contents of a table to the specified output directory.

Example:
```js
const SqliteToJson = require('sqlite-to-json');
const sqlite3 = require('sqlite3');
const exporter = new SqliteToJson({
  client: new sqlite3.Database('./mydb.sqlite3')
});
exporter.save('table_name', './data/table_name.json', function (err) {
  // no error and you're good.
});
```

### all(cb)

Returns the entire database and all tables as a single object.

Example:
```js
const SqliteToJson = require('sqlite-to-json');
const sqlite3 = require('sqlite3');
const exporter = new SqliteToJson({
  client: new sqlite3.Database('./mydb.sqlite3')
});
exporter.all(function (err, all) {
  // all your data here
});
```

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