-
Notifications
You must be signed in to change notification settings - Fork 15
Implement filesystem functions for node.js #19
Conversation
Filled this in based on what was returned by the Puter SDK stat(). A few do not apply, or it's not obvious what they should be.
And also add missing copyright.
@@ -48,7 +49,11 @@ export default { | |||
try { | |||
stat = await filesystem.stat(path); | |||
} catch (e) { | |||
if ( e.code !== 'subject_does_not_exist' ) throw e; | |||
if ( POSIX ) { |
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.
This gives me an idea; we should probably translate errors inside platform support. filesystem.capabilities
is meant to represent more significant filesystem differences (ex: puter directories can be associated with subdomains, ACL vs POSIX-style permissions, etc)
I like the idea of having an object called ERR_NO_ENTITY
(could have properties like posixLabel: 'ENOENT'
, description: '...'
) - then it's just an object reference comparison instead of a string comparison here too.
I might merge this first and then we can change this after.
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.
That makes sense! The less the builtins have to know/care about the platform, the better.
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 can't find any documentation for Puter SDK errors. I'd need to know their codes to be able to translate them - and generally it would be useful for API users if https://docs.puter.com listed the errors for each API call.
I've attempted to match the behaviour of
puter/filesystem.js
as much as possible. I've updated a couple of the builtins, but I haven't thoroughly checked all of them, these are just the ones I noticed needed changes when using them to test the filesystem API.Contributes to #14.