how to access to the zotero.sqlite using javascript? mentions zotero.sqlite database could be accessed. I would like to know which functions should be used to get the attachment items paths in zotero.sqlite database.

Could the codes in be used?

var fs = require('fs');
var initSqlJs = require('sql-wasm.js');
var filebuffer = fs.readFileSync('test.sqlite');

// Load the db
var db = new SQL.Database(filebuffer);

  • If you mean from the Run JavaScript window, you shouldn't be doing anything remotely like that. Zotero already has a connection to its database. You can issue SQL commands with Zotero.DB functions, though you shouldn't be doing any writes to the database via SQL.

    If you mean from outside of Zotero, that's a general programming question, and you should ask in a general programming forum.
  • @johnmy: But please post further development questions to zotero-dev — we try to keep technical questions there.
  • thanks @dstillman .
    I would like to run it in JavaScript window.
  • OK, so it doesn't make sense there at all.
Sign In or Register to comment.