JSPM

  • Created
  • Published
  • Downloads 1280526
  • Score
    100M100P100Q184666F
  • License MIT

The fastest and simplest library for SQLite3 in Node.js.

Package Exports

  • better-sqlite3

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (better-sqlite3) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

better-sqlite3 Build Status

The fastest and simplest library for SQLite3 in Node.js.

  • Full transaction support
  • Geared for performance and efficiency
  • Easy-to-use synchronous API (faster than an asynchronous API... yes, you read that correctly)
  • 64-bit integer support (invisible until you need it)

Installation

npm install --save better-sqlite3

Usage

var Database = require('better-sqlite3');
var db = new Database('foobar.db', options);

db.on('open', function () {
    var row = db.prepare('SELECT * FROM users WHERE id=?').get(userId);
    console.log(row.firstName, row.lastName, row.email);
});

Why should I use this instead of node-sqlite3?

  • node-sqlite3 uses asynchronous APIs for tasks that don't wait for I/O. That's not only bad design, but it wastes tons of resources.
  • node-sqlite3 exposes low-level (C language) memory management functions. better-sqlite3 does it the JavaScript way, allowing the garbage collector to worry about memory management.
  • better-sqlite3 is simpler to use, and it provides nice utilities for some operations that are very difficult or impossible in node-sqlite3.
  • better-sqlite3 is much faster than node-sqlite3 in most cases, and just as fast in all other cases.

Documentation

License

MIT