Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/dan-online/cabinet
Cabinet, the easier way to manage files in Deno
https://github.com/dan-online/cabinet
cabinet deno denoland file filemanager files filesystem
Last synced: 4 months ago
JSON representation
Cabinet, the easier way to manage files in Deno
- Host: GitHub
- URL: https://github.com/dan-online/cabinet
- Owner: dan-online
- Created: 2020-06-16T19:49:48.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2023-12-03T08:40:48.000Z (about 1 year ago)
- Last Synced: 2024-05-01T16:46:18.160Z (10 months ago)
- Topics: cabinet, deno, denoland, file, filemanager, files, filesystem
- Language: TypeScript
- Homepage: https://cabinet-benchmarks.netlify.app/
- Size: 15.6 MB
- Stars: 7
- Watchers: 3
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
Awesome Lists containing this project
README
> Cabinet, the easier way to manage files in Deno
# Cabinet
A module created for [Deno](https://deno.land) by [DanCodes](https://dancodes.online)
![.github/workflows/deno-win.yml](https://github.com/dan-online/cabinet/workflows/.github/workflows/deno-win.yml/badge.svg)
![.github/workflows/deno-linux.yml](https://github.com/dan-online/cabinet/workflows/.github/workflows/deno-linux.yml/badge.svg)
![.github/workflows/deno-mac.yml](https://github.com/dan-online/cabinet/workflows/.github/workflows/deno-mac.yml/badge.svg)
[![DanCodes Discord](https://img.shields.io/discord/478586684666150934?color=%237289DA&label=discord%20support&logo=discord&logoColor=%23fff)](https://discord.gg/fdpcZAA)
![GitHub repo size](https://img.shields.io/github/repo-size/dan-online/cabinet)
![GitHub tag (latest by date)](https://img.shields.io/github/v/tag/dan-online/cabinet)
[![Docs](https://img.shields.io/badge/deno-docs-green?logo=deno&color=informational)](https://doc.deno.land/https/deno.land/x/cabinet/mod.ts)
[![Docs](https://img.shields.io/badge/deno-module-red?logo=deno)](https://deno.land/x/cabinet)
[![nest badge](https://nest.land/badge-block.svg)](https://nest.land/package/cabinet)### Demo
This demo will open a file called testing.txt, write to it and then finally read it and display the contents in the console.
```bash
deno run --allow-write --allow-read https://deno.land/x/cabinet/demo.ts
```### Todo
- Add file moving
- Add resolve function for stringified file### Testing
```bash
deno test -A
```### Use
```typescript
import {
Cabinet,
CabinetFile,
CabinetError,
} from "https://deno.land/x/cabinet/mod.ts";const file = new Cabinet("./testing.txt");
file.write("The date is " + new Date());
file.write("The date is " + new Date(), () => console.log("finished!"));
file.writer.sync("This was written synchronously");
file.writer
.promise("This was written with a promise")
.then(() => console.log("finished!"));file.writer.callback("This was written with a callback", () =>
console.log("finished!")
);file.read();
file.read(() => console.log("finished!"));
file.reader.sync();
file.reader.promise().then((cFile: CabinetFile) => {
console.log("read " + cFile.size.mb + "mb in promise");
});file.reader.callback((err?: CabinetError, cFile?: CabinetFile) => {
console.log("read " + cFile?.size.mb + "mb in callback");
});
```## Format code
```bash
deno fmt **/*.ts
```## Resources
- [Deno Website](https://deno.land)
- [Deno Style Guide](https://deno.land/std/style_guide.md)
- [Deno Gitter](https://gitter.im/denolife/Lobby)