Coder Social home page Coder Social logo

mini-fs's People

Contributors

flaviojs avatar germangb avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

mini-fs's Issues

Rename structs

This is a suggestion.

As I stated in #1 (comment), the names were confusing me because it's not named with a filesystem perspective.

I suggest the following name changes:

  • Zip to ZipFs
  • Tar to TarFs
  • Local to LocalFs
  • Ram to RamFs
  • HelloWorld to HelloWorldFs
  • (if it always represents a file) ZipEntry to ZipFile or ZipFsFile
  • (if it always represents a file) TarEntry to TarFile or TarFsFile

I can make a PR after you give feedback.

Shadowing in tupple overlay

How do you want shadowing to work?
It's clear that files should shadow other files with the same path, but what about dirs?

Right now with a tupple overlay a "/a" file with prevent the "/a" dir ("/a/a" file) of another store from appearing in the entries iterator of "/", but you can still open the "/a/a" file so it's actually a partial shadow.
(dir shadows the file if you reverse the order)

Personally, I would allow at most one file entry and one dir entry with the same name.
This would mean one "a" file entry and one "a" dir entry from the entries iterator in the example above.

The initial design of this crate seemed file-centric, so I think it fits too. :)
(dirs wouldn't be able to shadow files)

Too limited

I tried to use this crate in a project but it was too limited for my case.

I wanted to use another file format so I tried to implement a Store based on your Tar and Zip, but the File constructors are public only inside your crate so I can't implement Store::open.

I also needed my paths to be case-insensitive. I tried to implement a Store that maps uppercase paths to case-sensitive paths, but there is no way to list the file paths inside a Store so I can't implement it.

RamFs entries returns directory entries as files

The version was bumped to 0.2 so I tried implementing a CaselessFs and found a problem with RamFs during my tests.

This code:

    let mut ram = RamFs::new();
    ram.touch("/a.txt", b"low a".to_vec());
    ram.touch("/A.TXT", b"high a".to_vec());
    ram.touch("/b/b.txt", b"low b".to_vec());
    ram.touch("/B/B.TXT", b"high b".to_vec());
    for entry in ram.entries("/").unwrap() {
        println!("{:?}", &entry);
    }

prints this:

Ok(Entry { name: "A.TXT", kind: File })
Ok(Entry { name: "a.txt", kind: File })
Ok(Entry { name: "B", kind: File })
Ok(Entry { name: "b", kind: File })

B and b are directories, not files.

Add write support

Hey,

I'm involved in the IconPie project, and we are contemplating using your crate.

Unfortunately we would need to be able to write data, which is currently not implemented, unless I'm mistaken.

Could you consider adding write support to mini_fs ?

Cheers!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.