6.4k sao GitHub và vẫn tăng — TryGhost/node-sqlite3 là dự án PLpgSQL mà TopGit đang theo dõi trên nền tảng. SQLite3 bindings for Node.js
Tóm tắt dựng từ metadata GitHub của chính dự án — chưa có bài review TopGit. Trang sẽ tự động cập nhật khi bài review đầy đủ được xuất bản.
VÌ SAO CHƯA CÓ REVIEW
TopGit viết bài đầy đủ cho repo có nhiều sao nhất và được yêu cầu nhiều nhất. Trang này là snapshot trong thời gian chờ — xem README gốc ở tab READ ME.
sqlite3 v5+ was rewritten to use Node-API 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 to ensure your Node version supports one of these. The prebuilt binaries should be supported on Node v20.17.0+.
The module uses prebuild-install 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:
darwin-arm64
darwin-x64
linux-arm64
linux-x64
linuxmusl-arm64
linuxmusl-x64
win32-x64
Unfortunately, prebuild cannot differentiate between armv6 and armv7, and instead uses arm as the {arch}. Until that is fixed, you will still need to install sqlite3 from source.
Support for other platforms and architectures may be added in the future if CI supports building on them.
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.
Other ways to install
It is also possible to make your own build of sqlite3 from its source instead of its npm package (See below.).
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.)
API
See the API documentation in the wiki.
Usage
Note: the module must be installed before use.
const sqlite3 = require('sqlite3').verbose();
const db = new sqlite3.Database(':memory:');
db.serialize(() => {
db.run("CREATE TABLE lorem (info TEXT)");
const stmt = db.prepare("INSERT INTO lorem VALUES (?)");
for (let i = 0; i < 10; i++) {
stmt.run("Ipsum " + i);
}
stmt.finalize();
db.each("SELECT rowid AS id, info FROM lorem", (err, row) => {
console.log(row.id + ": " + row.info);
});
});
db.close();
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:
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:
The default sqlite file header is "SQLite format 3". You can specify a different magic, though this will make standard tools and libraries unable to work with your files.
Build the module with the custom flags of --runtime, --target_arch, and --target:
NODE_WEBKIT_VERSION="0.8.6" # see latest version at https://github.com/rogerwang/node-webkit#downloads
npm install sqlite3 --build-from-source --runtime=node-webkit --target_arch=ia32 --target=$(NODE_WEBKIT_VERSION)
You can also run this command from within a sqlite3 checkout:
You must provide the right --target_arch flag. ia32 is needed to target 32bit node-webkit builds, while x64 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.
Visit the “Using Node modules” article in the node-webkit's wiki for more details.
Building for SQLCipher
For instructions on building SQLCipher, see Building SQLCipher for Node.js. Alternatively, you can install it with your local package manager.
To run against SQLCipher, you need to compile sqlite3 from source by passing build options like:
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):
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.
This module was originally created by Mapbox & is now maintained by Ghost.
Changelog
We use GitHub releases for notes on the latest versions. See CHANGELOG.md in git history for details on older versions.
Trang TopGit này là một snapshot — tab "Readme" hiển thị nguyên văn README của repo (đã bỏ link, giữ ảnh). Repo GitHub ở github.com/TryGhost/node-sqlite3 là nguồn chính thức.
TryGhost/node-sqlite3 có bao nhiêu sao?
TryGhost/node-sqlite3 có 6.4k sao GitHub — tải lại trang để xem số mới nhất, hoặc xem trực tiếp github.com/TryGhost/node-sqlite3. TopGit phản chiếu số sao của GitHub nhưng không cam kết đến từng phút.
TryGhost/node-sqlite3 có tag gì không?
Bản đồng bộ chưa ghi nhận topic GitHub nào cho TryGhost/node-sqlite3. GitHub topics hiển thị ở thanh bên phải trang repo — đó là nơi đáng kiểm tra nhất.
TryGhost/node-sqlite3 còn đang phát triển không?
Commit gần nhất trên TryGhost/node-sqlite3 là 1 tháng trước (theo timestamp GitHub). Repo có 845 fork — một chỉ báo về mức độ quan tâm của cộng đồng.
TryGhost/node-sqlite3 viết bằng ngôn ngữ gì?
TryGhost/node-sqlite3 chủ yếu viết bằng PLpgSQL. Trường "language" của GitHub dựa trên phần lớn byte ở nhánh mặc định.
Đọc đầy đủ README ở tab phía trên.
Chưa chắc node-sqlite3 có hợp với bạn?
Để ChatGPT, Claude hoặc Perplexity tìm hiểu giúp — bấm bên dưới và xem AI nói gì về node-sqlite3.