graphicore / ufoJS

Javascript API for the Unified Font Object
lib.ufojs.org
GNU General Public License v3.0
52 stars 10 forks source link

Add recursive directory (& contents) removal to io #20

Closed rrthomas closed 10 years ago

rrthomas commented 10 years ago

In order to achieve this, I performed some restructuring:

  1. Make the io implementation modules actually inherit from _base, but statically (should this be a documented pattern in the coding style wiki page?)
  2. Implement readDir and stat methods in staticNodeJS module only (it’s not obvious to me how to implement them in REST).
  3. Implement rmDirRecursive as an abstract method. At the moment it will only work in Node, because of the missing methods in REST (see 2 above).
graphicore commented 10 years ago

it’s not obvious to me how to implement them in REST This breaks compatibillity between the differenent adpters.

We could think of something like this for our REST. For example, we are returning a list of directory contents for a GET when the url ends with a slash, that's our own API, nothing HTTP describes.

Maybe we could just use a special "GET" that for example adds a custom header, like, "x-ufojs-io-stat" or so. Then we return a json(?) serialisation of the nodejs stat object. One question is, what happens if the stat object has too much information for some use cases (i.e. a ZIP adapter or a local storage adapter). We may want to describe what we expect from "our" stat data object. A lot of the information that stat returns is not available for other storing mechanisms or would mean more work for the implementor.

rrthomas commented 10 years ago

I'd rather worry about this case when we actually want it. Then, my first question would be, what does WebDAV do?