Git Product home page Git Product logo

Comments (2)

Jamesernator avatar Jamesernator commented on September 16, 2024 2

Would Storage Buckets address this use case? The current implementation only works with IndexedDB, but the eventual plan is to enable it for other storage methods as well.

Plausibly, though from reading the explainer it seems that deletion is still in general lazy, i.e. when disk storage becomes high. Like if I do the following:

class Archive {
    static async create() {
        const bucketId = crypto.randomUUID();
        const bucket = navigator.storageBuckets.open(this.#bucketId, { persistent: false });
        return new Archive(bucketId, bucket);
    }

    constructor(bucketId, bucket) {
        this.#bucketId = bucketId;
        this.#bucket = bucket;
    }
    
    addFile(fileName, blobSource) {
        const rootDir = await this.#bucket.getDirectory();
        const filesDir = await rootDir.getDirectoryHandle("files", { create: true });
        // add file to files dir
    }
    
    async encode() {
        const dir = await this.#bucket.getDirectory();
        const archive = await dir.getFileHandle("archive.ext", { create: true });
        // encode things to the archive
        return archive;
    }

    async dispose() {
        await navigator.storageBuckets.delete(this.#bucketId);
    }
}

and create an archive, and close the page before .dispose() is called, then files within the storage bucket will still be on disk until disk usage is high. Thus it'd be wasting disk space for something that will never be accessed again.

From the issues on storage buckets it seems like session buckets is probably the most appropriate place for this, so I'll close this issue.

from fs.

tomayac avatar tomayac commented on September 16, 2024

Would Storage Buckets address this use case? The current implementation only works with IndexedDB, but the eventual plan is to enable it for other storage methods as well.

from fs.

Related Issues (20)

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.