database-js-json
A database-js driver for JSON files.
About
This is a wrapper around the jl-sql-api, intended to be used with database-js for handling JSON files.
Our releases adopt Semantic Versioning.
Install
npm install database-js-json
Basic Usage
var Connection = Connection; async { const connection = 'json:///test.json' ; try let statement = await connection; let rows = await statement; console; catch error console; finally await connection; } ;
Basic Options
Options can be passed as arguments to the database connection string, in URL-format.
-
charset
: defines the charset (encoding) used to handle the JSON file- Defaults to
utf-8
- Example:
const connection = new Database( 'json:///test.json?charset=utf-16' );
- Available in database-js-json version
1.0.0
or later
- Defaults to
-
checkOnConnect
: whether it should check if the file exists when connecting to it- Defaults to
true
- Example:
const connection = new Database( 'json:///test.json?checkOnConnect=false' );
- Accepts
false
,no
or0
as false - Available in database-js-json version
1.1.0
or later
- Defaults to
Additional Options
Options from jl-sql-api can also be passed as arguments to the database connection.
Example: { tmpDir: "/path/to/dir" }
const connection = 'json:///test.json?tmpDir=path/to/dir' ;
When an option that belongs to a group is informed, it must have a dot.
Example: { tmpDir: "/path/to/dir", sortOptions: { inMemoryBufferSize: 32000 } }
const connection = 'json:///test.json?tmpDir=path/to/dir&sortOptions.inMemoryBufferSize=32000' ;