Installations
npm install vscode-sqlite3
Developer Guide
Typescript
Yes
Module System
CommonJS
Node Version
15.8.0
NPM Version
7.5.1
Score
70.3
Supply Chain
99.3
Quality
78.1
Maintenance
100
Vulnerability
99.6
License
Releases
Contributors
Unable to fetch Contributors
Languages
PLpgSQL (70.95%)
JavaScript (14.48%)
C++ (13.86%)
Python (0.23%)
Makefile (0.2%)
C (0.17%)
Dockerfile (0.08%)
HTML (0.03%)
Developer
mapbox
Download Statistics
Total Downloads
825,702
Last Day
1
Last Week
27
Last Month
448
Last Year
9,254
GitHub Statistics
6,253 Stars
1,455 Commits
817 Forks
184 Watching
10 Branches
93 Contributors
Package Meta Information
Latest Version
4.0.11
Package Id
vscode-sqlite3@4.0.11
Size
2.83 MB
NPM Version
7.5.1
Node Version
15.8.0
Publised On
09 Apr 2021
Total Downloads
Cumulative downloads
Total Downloads
825,702
Last day
-80%
1
Compared to previous day
Last week
-63%
27
Compared to previous week
Last month
-64.2%
448
Compared to previous month
Last year
-17.5%
9,254
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
Asynchronous, non-blocking SQLite3 bindings for Node.js.
Supported platforms
The sqlite3
module works with Node.js v4.x, v6.x, v8.x, v10.x, v11.x and v12.x.
Binaries for most Node versions and platforms are provided by default via node-pre-gyp.
The sqlite3
module also works with node-webkit if node-webkit contains a supported version of Node.js engine. (See below.)
SQLite's SQLCipher extension is also supported. (See below.)
Usage
Note: the module must be installed before use.
1var sqlite3 = require('sqlite3').verbose(); 2var db = new sqlite3.Database(':memory:'); 3 4db.serialize(function() { 5 db.run("CREATE TABLE lorem (info TEXT)"); 6 7 var stmt = db.prepare("INSERT INTO lorem VALUES (?)"); 8 for (var i = 0; i < 10; i++) { 9 stmt.run("Ipsum " + i); 10 } 11 stmt.finalize(); 12 13 db.each("SELECT rowid AS id, info FROM lorem", function(err, row) { 14 console.log(row.id + ": " + row.info); 15 }); 16}); 17 18db.close();
Features
- Straightforward query and parameter binding interface
- Full Buffer/Blob support
- Extensive debugging support
- Query serialization API
- Extension support
- Big test suite
- Written in modern C++ and tested for memory leaks
- Bundles Sqlite3 3.26.0 as a fallback if the installing system doesn't include SQLite
API
See the API documentation in the wiki.
Installing
You can use npm
to download and install:
-
The latest
sqlite3
package:npm install sqlite3
-
GitHub's
master
branch:npm install https://github.com/mapbox/node-sqlite3/tarball/master
The module uses node-pre-gyp to download a pre-compiled binary for your platform, if it exists. Otherwise, it uses node-gyp
to build the extension.
It is also possible to make your own build of sqlite3
from its source instead of its npm package (see below).
It is possible to use the installed package in node-webkit instead of the vanilla Node.js. See Building for node-webkit for details.
Source install
To skip searching for pre-compiled binaries, and force a build from source, use
npm install --build-from-source
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.
If you wish to install against an external sqlite then you need to pass the --sqlite
argument to npm
wrapper:
npm install --build-from-source --sqlite=/usr/local
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.
Note, if building against homebrew-installed sqlite on OS X you can do:
npm install --build-from-source --sqlite=/usr/local/opt/sqlite/
By default the node-gyp install will use python
as part of the installation. A
different python executable can be specified on the command line.
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
Building for node-webkit
Because of ABI differences, sqlite3
must be built in a custom to be used with node-webkit.
To build node-sqlite3 for node-webkit:
-
Install
nw-gyp
globally:npm install nw-gyp -g
(unless already installed) -
Build the module with the custom flags of
--runtime
,--target_arch
, and--target
:
1NODE_WEBKIT_VERSION="0.8.6" # see latest version at https://github.com/rogerwang/node-webkit#downloads 2npm install sqlite3 --build-from-source --runtime=node-webkit --target_arch=ia32 --target=$(NODE_WEBKIT_VERSION)
This command internally calls out to node-pre-gyp
which itself calls out to nw-gyp
when the --runtime=node-webkit
option is passed.
You can also run this command from within a node-sqlite3
checkout:
1npm install --build-from-source --runtime=node-webkit --target_arch=ia32 --target=$(NODE_WEBKIT_VERSION)
Remember the following:
-
You must provide the right
--target_arch
flag.ia32
is needed to target 32bit node-webkit builds, whilex64
will target 64bit node-webkit builds (if available for your platform). -
After the
sqlite3
package is built for node-webkit it cannot run in the vanilla Node.js (and vice versa).- For example,
npm test
of the node-webkit's package would fail.
- For example,
Visit the “Using Node modules” article in the node-webkit's wiki for more details.
Building for sqlcipher
For instructions for building sqlcipher see Building SQLCipher for node.js
To run node-sqlite3 against sqlcipher you need to compile from source by passing build options like:
npm install sqlite3 --build-from-source --sqlite_libname=sqlcipher --sqlite=/usr/
node -e 'require("sqlite3")'
If your sqlcipher is installed in a custom location (if you compiled and installed it yourself), you'll also need to to set some environment variables:
On OS X with Homebrew
Set the location where brew
installed it:
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")'
On most Linuxes (including Raspberry Pi)
Set the location where make
installed it:
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")'
Custom builds and Electron
Running sqlite3 through electron-rebuild does not preserve the sqlcipher extension, so some additional flags are needed to make this build Electron compatible. Your npm install sqlite3 --build-from-source
command needs these additional flags (be sure to replace the target version with the current Electron version you are working with):
--runtime=electron --target=1.7.6 --dist-url=https://atom.io/download/electron
In the case of MacOS with Homebrew, the command should look like the following:
npm install sqlite3 --build-from-source --sqlite_libname=sqlcipher --sqlite=`brew --prefix` --runtime=electron --target=1.7.6 --dist-url=https://atom.io/download/electron
Testing
mocha is required to run unit tests.
In sqlite3's directory (where its package.json
resides) run the following:
npm install mocha
npm test
Contributors
- Konstantin Käfer
- Dane Springmeyer
- Will White
- Orlando Vazquez
- Artem Kustikov
- Eric Fredricksen
- John Wright
- Ryan Dahl
- Tom MacWright
- Carter Thaxton
- Audrius Kažukauskas
- Johannes Schauer
- Mithgol
Acknowledgments
Thanks to Orlando Vazquez, Eric Fredricksen and Ryan Dahl for their SQLite bindings for node, and to mraleph on Freenode's #v8 for answering questions.
Development of this module is sponsored by MapBox.
License
node-sqlite3
is BSD licensed.
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
no dangerous workflow patterns detected
Reason
0 existing vulnerabilities detected
Reason
license file detected
Details
- Info: project has a license file: LICENSE:0
- Info: FSF or OSI recognized license: BSD 3-Clause "New" or "Revised" License: LICENSE:0
Reason
security policy file detected
Details
- Info: security policy file detected: github.com/TryGhost/.github/SECURITY.md:1
- Info: Found linked content: github.com/TryGhost/.github/SECURITY.md:1
- Info: Found disclosure, vulnerability, and/or timelines in security policy: github.com/TryGhost/.github/SECURITY.md:1
- Info: Found text in security policy: github.com/TryGhost/.github/SECURITY.md:1
Reason
branch protection is not maximal on development and all release branches
Details
- Info: 'allow deletion' disabled on branch 'master'
- Info: 'force pushes' disabled on branch 'master'
- Warn: branch 'master' does not require approvers
- Warn: codeowners review is not required on branch 'master'
- Warn: no status checks found to merge onto branch 'master'
Reason
Found 0/22 approved changesets -- score normalized to 0
Reason
1 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
detected GitHub workflow tokens with excessive permissions
Details
- Warn: no topLevel permission defined: .github/workflows/ci.yml:1
- Info: no jobLevel write permissions found
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:43: update your workflow using https://app.stepsecurity.io/secureworkflow/TryGhost/node-sqlite3/ci.yml/master?enable=pin
- Warn: third-party GitHubAction not pinned by hash: .github/workflows/ci.yml:57: update your workflow using https://app.stepsecurity.io/secureworkflow/TryGhost/node-sqlite3/ci.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:101: update your workflow using https://app.stepsecurity.io/secureworkflow/TryGhost/node-sqlite3/ci.yml/master?enable=pin
- Warn: third-party GitHubAction not pinned by hash: .github/workflows/ci.yml:135: update your workflow using https://app.stepsecurity.io/secureworkflow/TryGhost/node-sqlite3/ci.yml/master?enable=pin
- Warn: third-party GitHubAction not pinned by hash: .github/workflows/ci.yml:138: update your workflow using https://app.stepsecurity.io/secureworkflow/TryGhost/node-sqlite3/ci.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:155: update your workflow using https://app.stepsecurity.io/secureworkflow/TryGhost/node-sqlite3/ci.yml/master?enable=pin
- Warn: containerImage not pinned by hash: tools/BinaryBuilder.Dockerfile:4
- Warn: npmCommand not pinned by hash: tools/BinaryBuilder.Dockerfile:13
- Warn: npmCommand not pinned by hash: .github/workflows/ci.yml:51
- Warn: pipCommand not pinned by hash: .github/workflows/ci.yml:55
- Info: 2 out of 5 GitHub-owned GitHubAction dependencies pinned
- Info: 0 out of 3 third-party GitHubAction dependencies pinned
- Info: 0 out of 1 containerImage dependencies pinned
- Info: 0 out of 2 npmCommand dependencies pinned
- Info: 0 out of 1 pipCommand dependencies pinned
Reason
project is not fuzzed
Details
- Warn: no fuzzer integrations found
Reason
Project has not signed or included provenance with any releases.
Details
- Warn: release artifact v5.1.7 not signed: https://api.github.com/repos/TryGhost/node-sqlite3/releases/135930881
- Warn: release artifact v5.1.7-rc.0 not signed: https://api.github.com/repos/TryGhost/node-sqlite3/releases/135348398
- Warn: release artifact v5.1.6 not signed: https://api.github.com/repos/TryGhost/node-sqlite3/releases/95547756
- Warn: release artifact v5.1.5 not signed: https://api.github.com/repos/TryGhost/node-sqlite3/releases/95417474
- Warn: release artifact v5.1.4 not signed: https://api.github.com/repos/TryGhost/node-sqlite3/releases/85739520
- Warn: release artifact v5.1.7 does not have provenance: https://api.github.com/repos/TryGhost/node-sqlite3/releases/135930881
- Warn: release artifact v5.1.7-rc.0 does not have provenance: https://api.github.com/repos/TryGhost/node-sqlite3/releases/135348398
- Warn: release artifact v5.1.6 does not have provenance: https://api.github.com/repos/TryGhost/node-sqlite3/releases/95547756
- Warn: release artifact v5.1.5 does not have provenance: https://api.github.com/repos/TryGhost/node-sqlite3/releases/95417474
- Warn: release artifact v5.1.4 does not have provenance: https://api.github.com/repos/TryGhost/node-sqlite3/releases/85739520
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
- Warn: 0 commits out of 13 are checked with a SAST tool
Score
4
/10
Last Scanned on 2024-12-16
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More