npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@powersync/adapter-sql-js

v0.0.17

Published

A development db adapter based on SQL.js for JourneyApps PowerSync

Downloads

6,792

Readme

PowerSync SQL-JS Adapter

A development package for PowerSync which uses SQL.js to provide a pure JavaScript SQLite implementation. This eliminates the need for native dependencies and enables seamless development with Expo Go and other JavaScript-only environments.

This adapter is specifically intended to streamline the development workflow and will be much slower than DB adapters that use native dependencies. Every write operation triggers a complete rewrite of the entire database file to persistent storage, not just the changed data. In addition to the performance overheads, this adapter doesn't provide any of the SQLite consistency guarantees - you may end up with missing data or a corrupted database file if the app is killed while writing to the database file.

For production use, when building React Native apps we recommend switching to our react-native-quick-sqlite or OP-SQLite adapters when making production builds as they give substantially better performance.

Note: Alpha Release

This package is currently in an alpha release.

Usage

By default the SQLJS adapter will be in-memory. Read further for persister examples.

import { SQLJSOpenFactory } from '@powersync/adapter-sql-js';

const powersync = new PowerSyncDatabase({
  schema: AppSchema,
  database: new SQLJSOpenFactory({
    dbFilename: 'powersync.db'
  })
});

Persister examples

Expo

We can use the Expo File System to persist the database in an Expo app.

import { PowerSyncDatabase, SQLJSOpenFactory, SQLJSPersister } from '@powersync/react-native';
import * as FileSystem from 'expo-file-system';

const powersync = new PowerSyncDatabase({
  schema: AppSchema,
  database: new SQLJSOpenFactory({
    dbFilename: 'powersync.db',
    persister: createSQLJSPersister('powersync.db')
  })
});

const createSQLJSPersister = (dbFilename: string): SQLJSPersister => {
  const dbPath = `${FileSystem.documentDirectory}${dbFilename}`;

  return {
    readFile: async (): Promise<ArrayLike<number> | Buffer | null> => {
      try {
        const fileInfo = await FileSystem.getInfoAsync(dbPath);
        if (!fileInfo.exists) {
          return null;
        }

        const result = await FileSystem.readAsStringAsync(dbPath, {
          encoding: FileSystem.EncodingType.Base64
        });

        const binary = atob(result);
        const bytes = new Uint8Array(binary.length);
        for (let i = 0; i < binary.length; i++) {
          bytes[i] = binary.charCodeAt(i);
        }
        return bytes;
      } catch (error) {
        console.error('Error reading database file:', error);
        return null;
      }
    },

    writeFile: async (data: ArrayLike<number> | Buffer): Promise<void> => {
      try {
        const uint8Array = new Uint8Array(data);
        const binary = Array.from(uint8Array, (byte) => String.fromCharCode(byte)).join('');
        const base64 = btoa(binary);

        await FileSystem.writeAsStringAsync(dbPath, base64, {
          encoding: FileSystem.EncodingType.Base64
        });
      } catch (error) {
        console.error('Error writing database file:', error);
        throw error;
      }
    }
  };
};