Working with Files
Structure
import { hardDrive } from '$lib/store.js';
let id = '1Ggc8cPyxmAqp5tqKdo3s9';
let fs_item = $hardDrive[id];{
id: String,
//used to identify a fs_item
basename: String,
//name of the item without extension
ext: String,
//extension. e.g. .jpg, .png
name: String,
// = basename + ext. :) now I'm ashamed at this redundancy
size: Number,
//item size, in Kilobytes
date_created: Number,
//timestamp of the Date when item was first created,
date_modified: Number,
//timestamp of the Date when item was last modified,
storage_type: String,
//possible values include 'local' and 'remote'
//local: the content of the file is stored locally in IndexedDB as File
//remote: the content is on a web address (https or http)
url: String,
//if the storage_type is local, url is a id point to a File object
//in IndexedDB
//if the storage_type is remote, url is the web address of the file
parent: String,
//id of the parent folder (the folder that contains this fs_item)
children: [String],
//list of its children fs_items' ids
//if it's a file, then children is a empty array
}Operations
Create
Copy
Delete
Save
Read
fs_item's id to human-readable path
human-readable path to fs_item id
Last updated