Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@libsql/client

Package Overview
Dependencies
Maintainers
3
Versions
93
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@libsql/client

libSQL driver for TypeScript and JavaScript

  • 0.1.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
80K
increased by6.93%
Maintainers
3
Weekly downloads
 
Created
Source

libSQL client API for TypeScript and JavaScript

Node.js CI License

Getting Started

To get started, you need sqld running somewhere. Then:

import { createClient } from "@libsql/client"

const config = {
  url: "ws://localhost:8080"
};
const db = createClient(config);
const rs = await db.execute("SELECT * FROM users");
console.log(rs);

You can also connect to a local SQLite database with:

import { createClient } from "@libsql/client"

const config = {
  url: "file:local.db"
};
const db = createClient(config);
const rs = await db.execute("SELECT * FROM users");
console.log(rs);

Supported URLs

The client can connect to the database using different methods depending on the scheme (protocol) of the passed URL:

  • file: connects to a local SQLite database (using better-sqlite3)
    • file:/absolute/path or file:///absolute/path is an absolute path on local filesystem
    • file:relative/path is a relative path on local filesystem
    • (file://path is not a valid URL)
  • ws: or wss: connect to sqld using WebSockets (the Hrana protocol).
  • http: or https: connect to sqld using HTTP. The transaction() API is not available in this case.
  • libsql: is equivalent to wss:.

Keywords

FAQs

Package last updated on 31 Mar 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc