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.3
  • Source
  • npm
  • Socket score

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

JavaScript & TypeScript SDK for libSQL

Node.js CI License

This is the source repository of the JavaScript & TypeScript SDK for libSQL. You can either connect to a local SQLite/libSQL database (embedded in the client) or to a remote libSQL server.

Installation

npm install @libsql/client

Getting Started

Connecting to a local SQLite/libSQL database:

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);

Connecting to a remote libSQL server:

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);

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:.

License

This project is licensed under the MIT license.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in @libsql/client by you, shall be licensed as MIT, without any additional terms or conditions.

Keywords

FAQs

Package last updated on 24 Apr 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