https://github.com/jill64/d1-driver
🌤️ Cloudflare D1 External Fetch Compatible Driver
https://github.com/jill64/d1-driver
cloudflare d1 external fetch
Last synced: 10 months ago
JSON representation
🌤️ Cloudflare D1 External Fetch Compatible Driver
- Host: GitHub
- URL: https://github.com/jill64/d1-driver
- Owner: jill64
- License: mit
- Created: 2024-03-23T18:38:52.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2025-04-10T23:27:49.000Z (11 months ago)
- Last Synced: 2025-04-11T00:26:29.538Z (11 months ago)
- Topics: cloudflare, d1, external, fetch
- Language: TypeScript
- Homepage: https://npmjs.com/package/d1-driver
- Size: 420 KB
- Stars: 2
- Watchers: 2
- Forks: 1
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# d1-driver
🌤️ Cloudflare D1 External Fetch Compatible Driver
## Installation
```sh
npm i d1-driver
```
## Usage
```js
import { D1 } from 'd1-driver'
// Create a new instance of D1
const d1 = new D1('YOUR_CLOUDFLARE_ACCOUNT_ID', 'YOUR_CLOUDFLARE_API_KEY')
// List all databases
const db_list = await d1.list()
const db_uuid = db_list[0].uuid
// Get a database by UUID
await d1.get(db_uuid)
// Create a new database
await d1.create('new_database_name')
// Delete a database by UUID
await d1.delete(db_uuid)
// Query a database
await d1.query(db_uuid, 'SELECT * FROM table_name')
```
## License
[MIT](LICENSE)