Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

sqlite3

Package Overview
Dependencies
Maintainers
9
Versions
103
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sqlite3 - npm Package Compare versions

Comparing version 5.0.2 to 5.0.3

deps/extract.js

3

CHANGELOG.md
# Changelog
Please check [GitHub Releases](https://github.com/TryGhost/node-sqlite3/releases) for notes on more recent releases.
## 5.0.2

@@ -3,0 +6,0 @@ - build: rebuild binaries before publishing [#1426](https://github.com/mapbox/node-sqlite3/pull/1426)

2

lib/sqlite3-binding.js

@@ -1,2 +0,2 @@

var binary = require('node-pre-gyp');
var binary = require('@mapbox/node-pre-gyp');
var path = require('path');

@@ -3,0 +3,0 @@ var binding_path = binary.find(path.resolve(path.join(__dirname,'../package.json')));

{
"name": "sqlite3",
"description": "Asynchronous, non-blocking SQLite3 bindings",
"version": "5.0.2",
"homepage": "https://github.com/mapbox/node-sqlite3",
"version": "5.0.3",
"homepage": "https://github.com/TryGhost/node-sqlite3",
"author": {

@@ -13,7 +13,8 @@ "name": "MapBox",

"module_path": "./lib/binding/napi-v{napi_build_version}-{platform}-{arch}",
"host": "https://mapbox-node-binary.s3.amazonaws.com",
"remote_path": "./{name}/v{version}/{toolset}/",
"host": "https://github.com/TryGhost/node-sqlite3/releases/download/",
"remote_path": "v{version}",
"package_name": "napi-v{napi_build_version}-{platform}-{arch}.tar.gz",
"napi_versions": [
3
3,
6
]

@@ -41,16 +42,16 @@ },

"type": "git",
"url": "git://github.com/mapbox/node-sqlite3.git"
"url": "https://github.com/TryGhost/node-sqlite3.git"
},
"dependencies": {
"node-addon-api": "^3.0.0",
"node-pre-gyp": "^0.11.0"
"@mapbox/node-pre-gyp": "^1.0.0",
"node-addon-api": "^4.2.0",
"tar": "^6.1.11"
},
"devDependencies": {
"@mapbox/cloudfriend": "^1.9.0",
"aws-sdk": "2.x",
"eslint": "3.5.0",
"mocha": "^5.2.0"
"eslint": "6.8.0",
"mocha": "7.2.0",
"node-pre-gyp-github": "1.4.4"
},
"peerDependencies": {
"node-gyp": "3.x"
"node-gyp": "8.x"
},

@@ -63,3 +64,3 @@ "peerDependenciesMeta": {

"optionalDependencies": {
"node-gyp": "3.x"
"node-gyp": "8.x"
},

@@ -66,0 +67,0 @@ "scripts": {

@@ -0,77 +1,91 @@

# ⚙️ node-sqlite3
Asynchronous, non-blocking [SQLite3](https://sqlite.org/) bindings for [Node.js](http://nodejs.org/).
[![NPM](https://nodei.co/npm/sqlite3.png?downloads=true&downloadRank=true)](https://nodei.co/npm/sqlite3/)
[![Build Status](https://travis-ci.org/mapbox/node-sqlite3.svg?branch=master)](https://travis-ci.org/mapbox/node-sqlite3)
[![Build status](https://ci.appveyor.com/api/projects/status/gvm7ul0hpmdawqom)](https://ci.appveyor.com/project/Mapbox/node-sqlite3)
[![Coverage Status](https://coveralls.io/repos/mapbox/node-sqlite3/badge.svg?branch=master&service=github)](https://coveralls.io/github/mapbox/node-sqlite3?branch=master)
[![Dependencies](https://david-dm.org/mapbox/node-sqlite3.svg)](https://david-dm.org/mapbox/node-sqlite3)
[![Latest release](https://img.shields.io/github/release/TryGhost/node-sqlite3.svg)](https://www.npmjs.com/package/sqlite3)
![Build Status](https://github.com/TryGhost/node-sqlite3/workflows/CI/badge.svg?branch=master)
[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bhttps%3A%2F%2Fgithub.com%2Fmapbox%2Fnode-sqlite3.svg?type=shield)](https://app.fossa.io/projects/git%2Bhttps%3A%2F%2Fgithub.com%2Fmapbox%2Fnode-sqlite3?ref=badge_shield)
[![N-API v3 Badge](https://img.shields.io/badge/N--API-v3-green.svg)](https://nodejs.org/dist/latest/docs/api/n-api.html#n_api_n_api)
[![N-API v6 Badge](https://img.shields.io/badge/N--API-v6-green.svg)](https://nodejs.org/dist/latest/docs/api/n-api.html#n_api_n_api)
## Supported platforms
# Features
The `sqlite3` module works with:
* Node.js v11.x, v12.x, v13.x and v14.x.
* Electron v6.0.x, v6.1.x, v7.0.x, v7.1.x, v8.0.x, v8.1.x and v8.2.x
- Straightforward query and parameter binding interface
- Full Buffer/Blob support
- Extensive [debugging support](https://github.com/tryghost/node-sqlite3/wiki/Debugging)
- [Query serialization](https://github.com/tryghost/node-sqlite3/wiki/Control-Flow) API
- [Extension support](https://github.com/tryghost/node-sqlite3/wiki/Extensions), including bundled support for the [json1 extension](https://www.sqlite.org/json1.html)
- Big test suite
- Written in modern C++ and tested for memory leaks
- Bundles SQLite v3.38.2, or you can build using a local SQLite
Binaries for most Node versions and platforms are provided by default via [node-pre-gyp](https://github.com/mapbox/node-pre-gyp).
# Installing
The `sqlite3` module also works with [node-webkit](https://github.com/rogerwang/node-webkit) if node-webkit contains a supported version of Node.js engine. [(See below.)](#building-for-node-webkit)
You can use [`npm`](https://github.com/npm/cli) or [`yarn`](https://github.com/yarnpkg/yarn) to install `sqlite3`:
SQLite's [SQLCipher extension](https://github.com/sqlcipher/sqlcipher) is also supported. [(See below.)](#building-for-sqlcipher)
* (recommended) Latest package:
```bash
npm install sqlite3
# or
yarn add sqlite3
```
* GitHub's `master` branch: `npm install https://github.com/tryghost/node-sqlite3/tarball/master`
# Usage
### Prebuilt binaries
**Note:** the module must be [installed](#installing) before use.
`sqlite3` v5+ was rewritten to use [Node-API](https://nodejs.org/api/n-api.html) so prebuilt binaries do not need to be built for specific Node versions. `sqlite3` currently builds for both Node-API v3 and v6. Check the [Node-API version matrix](https://nodejs.org/api/n-api.html#node-api-version-matrix) to ensure your Node version supports one of these. The prebuilt binaries should be supported on Node v10+.
``` js
var sqlite3 = require('sqlite3').verbose();
var db = new sqlite3.Database(':memory:');
The module uses [node-pre-gyp](https://github.com/mapbox/node-pre-gyp) to download the prebuilt binary for your platform, if it exists. These binaries are hosted on GitHub Releases for `sqlite3` versions above 5.0.2, and they are hosted on S3 otherwise. The following targets are currently provided:
db.serialize(function() {
db.run("CREATE TABLE lorem (info TEXT)");
Format: `napi-v{napi_build_version}-{platform}-{arch}`
var stmt = db.prepare("INSERT INTO lorem VALUES (?)");
for (var i = 0; i < 10; i++) {
stmt.run("Ipsum " + i);
}
stmt.finalize();
* `napi-v3-darwin-x64`
* `napi-v3-linux-x64`
* `napi-v3-win32-ia32`
* `napi-v3-win32-x64`
* `napi-v6-darwin-x64`
* `napi-v6-linux-x64`
* `napi-v6-win32-ia32`
* `napi-v6-win32-x64`
db.each("SELECT rowid AS id, info FROM lorem", function(err, row) {
console.log(row.id + ": " + row.info);
});
});
Support for other platforms and architectures may be added in the future if CI supports building on them.
db.close();
```
If your environment isn't supported, it'll use `node-gyp` to build SQLite but you will need to install a C++ compiler and linker.
# Features
### Other ways to install
- Straightforward query and parameter binding interface
- Full Buffer/Blob support
- Extensive [debugging support](https://github.com/mapbox/node-sqlite3/wiki/Debugging)
- [Query serialization](https://github.com/mapbox/node-sqlite3/wiki/Control-Flow) API
- [Extension support](https://github.com/mapbox/node-sqlite3/wiki/Extensions), including bundled support for the [json1 extension](https://www.sqlite.org/json1.html).
- Big test suite
- Written in modern C++ and tested for memory leaks
- Bundles SQLite3 3.32.3 as a fallback if the installing system doesn't include SQLite
It is also possible to make your own build of `sqlite3` from its source instead of its npm package ([See below.](#building-from-the-source)).
The `sqlite3` module also works with [node-webkit](https://github.com/rogerwang/node-webkit) if node-webkit contains a supported version of Node.js engine. [(See below.)](#building-for-node-webkit)
SQLite's [SQLCipher extension](https://github.com/sqlcipher/sqlcipher) is also supported. [(See below.)](#building-for-sqlcipher)
# API
See the [API documentation](https://github.com/mapbox/node-sqlite3/wiki) in the wiki.
See the [API documentation](https://github.com/TryGhost/node-sqlite3/wiki/API) in the wiki.
# Installing
# Usage
You can use [`npm`](https://github.com/isaacs/npm) to download and install:
**Note:** the module must be [installed](#installing) before use.
* The latest `sqlite3` package: `npm install sqlite3`
``` js
const sqlite3 = require('sqlite3').verbose();
const db = new sqlite3.Database(':memory:');
* GitHub's `master` branch: `npm install https://github.com/mapbox/node-sqlite3/tarball/master`
db.serialize(() => {
db.run("CREATE TABLE lorem (info TEXT)");
The module uses [node-pre-gyp](https://github.com/mapbox/node-pre-gyp) to download a pre-compiled binary for your platform, if it exists. Otherwise, it uses `node-gyp` to build the extension.
const stmt = db.prepare("INSERT INTO lorem VALUES (?)");
for (let i = 0; i < 10; i++) {
stmt.run("Ipsum " + i);
}
stmt.finalize();
It is also possible to make your own build of `sqlite3` from its source instead of its npm package ([see below](#building-from-the-source)).
db.each("SELECT rowid AS id, info FROM lorem", (err, row) => {
console.log(row.id + ": " + row.info);
});
});
It is possible to use the installed package in [node-webkit](https://github.com/rogerwang/node-webkit) instead of the vanilla Node.js. See [Building for node-webkit](#building-for-node-webkit) for details.
db.close();
```

@@ -82,3 +96,5 @@ ## Source install

npm install --build-from-source
```bash
npm install --build-from-source
```

@@ -89,3 +105,5 @@ The sqlite3 module depends only on libsqlite3. However, by default, an internal/bundled copy of sqlite will be built and statically linked, so an externally installed sqlite3 is not required.

npm install --build-from-source --sqlite=/usr/local
```bash
npm install --build-from-source --sqlite=/usr/local
```

@@ -96,3 +114,5 @@ If building against an external sqlite3 make sure to have the development headers available. Mac OS X ships with these by default. If you don't have them installed, install the `-dev` package with your package manager, e.g. `apt-get install libsqlite3-dev` for Debian/Ubuntu. Make sure that you have at least `libsqlite3` >= 3.6.

npm install --build-from-source --sqlite=/usr/local/opt/sqlite/
```bash
npm install --build-from-source --sqlite=/usr/local/opt/sqlite/
```

@@ -102,7 +122,11 @@ By default the node-gyp install will use `python` as part of the installation. A

npm install --build-from-source --python=/usr/bin/python2
```bash
npm install --build-from-source --python=/usr/bin/python2
```
This uses the npm_config_python config, so values in .npmrc will be honoured:
python=/usr/bin/python2
```bash
python=/usr/bin/python2
```

@@ -119,3 +143,3 @@ ## Custom file header (magic)

Note that the magic *must* be exactly 15 characters long (16 bytes including null terminator).
## Building for node-webkit

@@ -131,3 +155,3 @@

```sh
```bash
NODE_WEBKIT_VERSION="0.8.6" # see latest version at https://github.com/rogerwang/node-webkit#downloads

@@ -141,3 +165,3 @@ npm install sqlite3 --build-from-source --runtime=node-webkit --target_arch=ia32 --target=$(NODE_WEBKIT_VERSION)

```sh
```bash
npm install --build-from-source --runtime=node-webkit --target_arch=ia32 --target=$(NODE_WEBKIT_VERSION)

@@ -155,3 +179,3 @@ ```

## Building for sqlcipher
## Building for SQLCipher

@@ -163,5 +187,7 @@ For instructions for building sqlcipher see

npm install sqlite3 --build-from-source --sqlite_libname=sqlcipher --sqlite=/usr/
```bash
npm install sqlite3 --build-from-source --sqlite_libname=sqlcipher --sqlite=/usr/
node -e 'require("sqlite3")'
node -e 'require("sqlite3")'
```

@@ -175,7 +201,9 @@ If your sqlcipher is installed in a custom location (if you compiled and installed it yourself),

export LDFLAGS="-L`brew --prefix`/opt/sqlcipher/lib"
export CPPFLAGS="-I`brew --prefix`/opt/sqlcipher/include"
npm install sqlite3 --build-from-source --sqlite_libname=sqlcipher --sqlite=`brew --prefix`
```bash
export LDFLAGS="-L`brew --prefix`/opt/sqlcipher/lib"
export CPPFLAGS="-I`brew --prefix`/opt/sqlcipher/include"
npm install sqlite3 --build-from-source --sqlite_libname=sqlcipher --sqlite=`brew --prefix`
node -e 'require("sqlite3")'
node -e 'require("sqlite3")'
```

@@ -186,8 +214,10 @@ ### On most Linuxes (including Raspberry Pi)

export LDFLAGS="-L/usr/local/lib"
export CPPFLAGS="-I/usr/local/include -I/usr/local/include/sqlcipher"
export CXXFLAGS="$CPPFLAGS"
npm install sqlite3 --build-from-source --sqlite_libname=sqlcipher --sqlite=/usr/local --verbose
```bash
export LDFLAGS="-L/usr/local/lib"
export CPPFLAGS="-I/usr/local/include -I/usr/local/include/sqlcipher"
export CXXFLAGS="$CPPFLAGS"
npm install sqlite3 --build-from-source --sqlite_libname=sqlcipher --sqlite=/usr/local --verbose
node -e 'require("sqlite3")'
node -e 'require("sqlite3")'
```

@@ -202,13 +232,12 @@ ### Custom builds and Electron

npm install sqlite3 --build-from-source --sqlite_libname=sqlcipher --sqlite=`brew --prefix` --runtime=electron --target=1.7.6 --dist-url=https://electronjs.org/headers
```bash
npm install sqlite3 --build-from-source --sqlite_libname=sqlcipher --sqlite=`brew --prefix` --runtime=electron --target=1.7.6 --dist-url=https://electronjs.org/headers
```
# Testing
[mocha](https://github.com/visionmedia/mocha) is required to run unit tests.
```bash
npm test
```
In sqlite3's directory (where its `package.json` resides) run the following:
npm install mocha
npm test
# Contributors

@@ -240,4 +269,4 @@

`node-sqlite3` is [BSD licensed](https://github.com/mapbox/node-sqlite3/raw/master/LICENSE).
`node-sqlite3` is [BSD licensed](https://github.com/tryghost/node-sqlite3/raw/master/LICENSE).
[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bhttps%3A%2F%2Fgithub.com%2Fmapbox%2Fnode-sqlite3.svg?type=large)](https://app.fossa.io/projects/git%2Bhttps%3A%2F%2Fgithub.com%2Fmapbox%2Fnode-sqlite3?ref=badge_large)

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc