Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: file read and write abstraction #47

Merged
merged 3 commits into from
Jun 25, 2024
Merged

feat: file read and write abstraction #47

merged 3 commits into from
Jun 25, 2024

Conversation

connerdouglass
Copy link
Member

@connerdouglass connerdouglass commented Jun 25, 2024

This PR creates a TypeScript abstraction layer around file access.

This builds on the work by @NexelOfficial in #44

Example usage:

import { Files } from '@customrealms/core';

Files.readString('server.properties'); // => entire file contents
Files.writeString('plugin-data.txt', 'score=100'); // => write a file
Files.exists('server.properties'); // => true
Files.stat('server.properties'); // => {size: 123, isDirectory: false}
Files.readdir('/path/to/folder'); // => ["server.properties", "plugins", ...]
Files.dirname('/path/to/folder'); // => "/path/to"
Files.mkdir('/path/to/folder', true); // recursively create folders
Files.remove('my-temp-file.txt'); // remove a file

@connerdouglass connerdouglass merged commit d61105b into master Jun 25, 2024
2 checks passed
@connerdouglass connerdouglass deleted the feat-files branch June 25, 2024 16:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant