
Security News
vlt Launches "reproduce": A New Tool Challenging the Limits of Package Provenance
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
@cretezy/cloudflare-d1-backup
Advanced tools
This script creates an backup/export of a Cloudflare D1 SQLite database. It uses the [D1 HTTP API](https://developers.cloudflare.com/api/operations/cloudflare-d1-query-database) to query for table definitions and data, then outputs SQL commands to recreat
This script creates an backup/export of a Cloudflare D1 SQLite database. It uses the D1 HTTP API to query for table definitions and data, then outputs SQL commands to recreate the database as-is.
This script has only been tested on small databases (~700KB). Please report any bugs using GitHub Issues.
Based on nora-soderlund/cloudflare-d1-backups, which requires to be ran inside a Worker. This repository uses the D1 HTTP API.
To create a backup, you must obtain:
dash.cloudflare.com/
, or in the sidebar of a zone.This will create the backup at backup.sql
.
CLOUDFLARE_D1_ACCOUNT_ID=... CLOUDFLARE_D1_DATABASE_ID=... CLOUDFLARE_D1_API_KEY=... \
npx @cretezy/cloudflare-d1-backup backup.sql
The CLI also supports reading from .env
.
You may also pass the --limit
to add a LIMIT clause for each SELECT query.
Default is 1000. You may need to lower if D1 crashes due to
Isolate Has exceeded Memory Size
. You can increase to speed up exports.
npm i @cretezy/cloudflare-d1-backup
import { createBackup } from "@cretezy/cloudflare-d1-backup";
const backup = await createBackup({
accountId: "...",
databaseId: "...",
apiKey: "...",
// Optional, see note above on --limit
limit: 1000,
});
backup
will be the string of the backup commands.
npx wrangler d1 execute <database> --file=<backup.sql>
<database>
must be the ID or name of the D1 database.
FAQs
This script creates an backup/export of a Cloudflare D1 SQLite database. It uses the [D1 HTTP API](https://developers.cloudflare.com/api/operations/cloudflare-d1-query-database) to query for table definitions and data, then outputs SQL commands to recreat
We found that @cretezy/cloudflare-d1-backup demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Security News
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
Research
Security News
Socket researchers uncovered a malicious PyPI package exploiting Deezer’s API to enable coordinated music piracy through API abuse and C2 server control.
Research
The Socket Research Team discovered a malicious npm package, '@ton-wallet/create', stealing cryptocurrency wallet keys from developers and users in the TON ecosystem.