-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Implement file create #908
Conversation
js/files_test.ts
Outdated
|
||
test(async function createFileSuccess() { | ||
const path = "test.txt"; | ||
let f = await deno.create(path); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you create the test file in a temporary directory? Like using a path given by deno.makeTempDir
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi - thanks for starting this - but create should be implemented in terms of open. Just the “mode” needs to be passed down.
export async function create(filename: string): Promise<File> { | ||
const builder = new flatbuffers.Builder(); | ||
const filename_ = builder.createString(filename); | ||
msg.Create.startCreate(builder); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this doesn’t need a separate msg. We should be able to reuse Open.
|
||
table CreateRes { | ||
rid: int; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reuse Open/OpenRes instead of adding this.
@@ -558,6 +559,41 @@ fn op_mkdir( | |||
}) | |||
} | |||
|
|||
fn op_create( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reuse op_open
@ry I think permission mode should be completed before restart it. Next I will try to work on permission design. |
If |
@ztplz I'm going to close this one as it's getting dated - if you come back to this project please open a new PR and link to this one. Thanks! |
Prior art:
go: func Create(name string) (*File, error)
rust: tokio::fs::File::create<P>(path: P) -> CreateFuture<P>