Git Product home page Git Product logo

hackpadfs's People

Contributors

johnstarich avatar paralin 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  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  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  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

hackpadfs's Issues

Request for a `sub` method that returns the original `FS`

// Sub implements hackpadfs.SubFS
func (fs *FS) Sub(dir string) (hackpadfs.FS, error) {
	if !hackpadfs.ValidPath(dir) {
		return nil, &hackpadfs.PathError{Op: "sub", Path: dir, Err: hackpadfs.ErrInvalid}
	}
	return &FS{
		root: path.Join(fs.root, dir),
	}, nil
}

I'd like to use Sub but get back the original *FS. So I think this would have to be a stand alone method, similar to context.WithCancel.

Web file system api

It’s on all browsers finally

https://developer.mozilla.org/en-US/docs/Web/API/File_System_Access_API

https://developer.mozilla.org/en-US/docs/Web/API/FileSystem

some simple examples:

https://github.com/WICG/file-system-access/blob/main/EXPLAINER.md

it would be really cool and is designed for browser based editors.

also indexdb has sone gremlins that this API removes. I guess indexdb could be you in browser cache of what’s in the users OS file system though.

there is possibly a lot we can leverage already in this code base already too

Bug: hackpadfs/os fails to root file name

Given the conditions:

  1. Current working directory is not /. (Say /tmp for example.)
  2. Get fs with: fsys, _ := hackpadfs_os.NewFS().Sub("mydir") (Assume /tmp/mydir/ exists.)
  3. Call fsys.Stat(".")

Stat fails with:

stat : no such file or directory

While debugging this, it is apparent that this is caused by fs.rootedPath assuming that the sub path is an absolute path, not a path relative to the cwd. I.e. given the example situation, it runs os.Stat("/mydir"), not os.Stat("/tmp/mydir") which is what I would expect.

The following go playground demonstrates: https://go.dev/play/p/hYuq0VNVybc

It seems Sub is not safe to use with paths relative to the cwd, and given that you can't use rooted paths (gofs.ValidPath disallows them), it is not usable in general.

local file cache of s3 assets

hey @JohnStarich

I was exploring how i can have a file cache.

the idea if that the clients ( web or native) can make requests to S3, but the results are cached, such that future requests use the cache, or on a cache miss use S3. This make writing code on top of hackpadFS much easier if your using it with s3.

https://github.com/NinesStack/filecache seems like a good fit for this.

If you have any thoughts on this before i start on this please feel free to let me know what you think...

is hackpad/os writable?

Hey there. Really cool project! Just trying this out and using a mem.NewFS() in a test works great. When I swap out my implementation with a os.NewFS(), I'm getting the following error.

mkdir out: read-only file system

My understanding was that os was writable. Is that incorrect?

For context, I'm writing a scaffolding tool that creates a bunch of directories and files. I'm looking for a library that can encapsulate the directory structure I'm creating and ease testing.

How to build HackpadFS on my Linux server

Sorry. Maybe the question is somewhat stupid.
I want to know how to build HackpadFS on my cloud server, through which I can store different types of data on the file system.
What I want is a storage system, which is between SQL and NoSQL. SQL system cannot storage many types of data. NoSQL is too flexible.
I hope the HackpadFS is the solution.
The point is how to build HacpadFS

Unified API for Browser and Native ?

Wondering if this is designed to provide an unified API for both Browser and Native ( mobile and desktop).

I am attempting to use this with gioui.org.
https://github.com/gioui

I got some basic code working for Browser, but struggled to get it also working for Native.

Context aware operations

Would you be open to accepting a PR adding context aware operations to hackpadfs, which fall back to non-context operations if the implementation doesn't support it?

This is largely for scenarios where the implementation is a cloud storage provider.

Potential dependency inconsistency

Dependency line:

github.com/hack-pad/hackpadfs/examples --> github.com/minio/minio --> github.com/gomodule/redigo

github.com/minio/minio 9ca25bd --> github.com/gomodule/redigo v1.8.5

https://github.com/minio/minio/blob/9ca25bd48f7fec228f246ef5452465be009d4d7a/go.mod#L234

Background

Repo github.com/minio/minio at version 9ca25bd uses replace directive to pin dependency github.com/gomodule/redigo to version v1.8.5.

According to Go Modules wikis, replace directives in modules other than the main module are ignored when building the main module.
It means such replace usage in dependency's go.mod cannot be inherited when building main module. And it turns out that github.com/hack-pad/hackpadfs/examples indirectly relies on gomodule/[email protected], which is different from the pinned version minio/minio needed.

https://github.com/hack-pad/hackpadfs/blob/main/examples/go.mod(Line 76)

github.com/gomodule/redigo v2.0.0+incompatible // indirect

https://github.com/minio/minio/blob/9ca25bd48f7fec228f246ef5452465be009d4d7a/go.mod(line 32&234)

github.com/gomodule/redigo v2.0.0+incompatible
replace github.com/gomodule/redigo => github.com/gomodule/redigo v1.8.5

So this is just a reminder in the hope that you can notice such an inconsistency.

Solution

1. Bump the version of dependency github.com/minio/minio

You may try upgrading dependency github.com/minio/minio to a newer version, which may have eliminated the use of this directive.

2. Add the same replace rule to your go.mod

replace github.com/gomodule/redigo => github.com/gomodule/redigo v1.8.5

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.