+/logjson-*.tgz
+/node_modules
+/package-lock.json
/tests/a.json
/tests/b.json
/tests/c.json
--- /dev/null
+#!/usr/bin/env node
+
+import fsPromises from 'fs/promises'
+import logjson from './index.mjs'
+
+if (process.argv.length < 4) {
+ console.log(`usage: ${process.argv[0]} ${process.argv[1]} database.json database.logjson`)
+ process.exit(1)
+}
+
+let database = new logjson.Database()
+await database.open(process.argv[3])
+let transaction = database.Transaction()
+transaction.set(
+ transaction.json_to_logjson(
+ JSON.parse(
+ (await fsPromises.readFile(process.argv[2])).toString('utf-8')
+ )
+ )
+)
+transaction.commit()
+await database.close()
--- /dev/null
+#!/usr/bin/env node
+
+import fsPromises from 'fs/promises'
+import logjson from './index.mjs'
+
+if (process.argv.length < 4) {
+ console.log(`usage: ${process.argv[0]} ${process.argv[1]} database.logjson database.json`)
+ process.exit(1)
+}
+
+let database = new logjson.Database()
+await database.open(process.argv[2])
+let transaction = database.Transaction()
+await fsPromises.writeFile(
+ process.argv[3],
+ Buffer.from(
+ JSON.stringify(
+ await logjson.logjson_to_json(await transaction.get()),
+ null,
+ 2
+ ) + '\n',
+ 'utf-8'
+ )
+)
+transaction.rollback()
+await database.close()
"bugs": {
"email": "nick@ndcode.org"
},
+ "bin": {
+ "json_to_logjson": "json_to_logjson.mjs",
+ "logjson_to_json": "logjson_to_json.mjs"
+ },
"main": "index.mjs",
"directories": {},
"dependencies": {},