FileSystem
class FileSystem implements API { }
constructor({ account, dependencies, eventEmitter, root, localOnly }: ConstructorParams);
_publishing: false | [CID, true];
_publishWhenOnline: Array<[CID, Ucan.Ucan]>;
account: AssociatedIdentity;
dependencies: Dependencies;
eventEmitter: EventEmitter<Events.FileSystem>;
readonly localOnly: boolean;
proofs: {};
[_: string]: Ucan.Ucan;
publishHooks: Array<PublishHook>;
root: RootTree;
_beforeLeaving(e: Event): void | string;
_whenOnline(): void;
acceptShare({ shareId, sharedBy }: {
shareId: string;
sharedBy: string;
}): Promise<this>;checkMutationPermissionAndAddProof(path: DistinctivePath<Partitioned<Partition>>, isMutation: boolean): Promise<void>;
deactivate(): void;
historyStep(): Promise<void>;
loadShare({ shareId, sharedBy }: {
shareId: string;
sharedBy: string;
}): Promise<UnixTree>;mkdir(path: Path.Directory<PartitionedNonEmpty<Partition>>, options?: MutationOptions): Promise<this>;
mv(from: Path.Distinctive<PartitionedNonEmpty<Partition>>, to: Path.Distinctive<PartitionedNonEmpty<Partition>>): Promise<this>;
publish(): Promise<CID>;
resolveSymlink(link: SoftLink): Promise<File | Tree | null>;
rm(path: DistinctivePath<Partitioned<Partition>>): Promise<this>;
runMutationOnNode(path: DistinctivePath<Partitioned<Partition>>, handlers: {
public(root: UnixTree, relPath: Path.Segments): Promise<void>;
private(node: PrivateTree | PrivateFile, relPath: Path.Segments): Promise<void>;
}): Promise<void>;runOnChildTree(
node: Tree,
relPath: Path.Segments,
fn: (tree: Tree) => Promise<Tree>,
): Promise<Tree>;runOnNode<A>(path: DistinctivePath<Partitioned<Partition>>, handlers: {
public(root: UnixTree, relPath: Path.Segments): Promise<A>;
private(node: Tree | File, relPath: Path.Segments): Promise<A>;
}): Promise<A>;sharePrivate(paths: Path.Distinctive<Path.PartitionedNonEmpty<Path.Private>>[], { sharedBy, shareWith }: {
sharedBy?: SharedBy;
shareWith: string | string[];
}): Promise<ShareDetails>;symlink(args: {
at: Path.Directory<Partitioned<Partition>>;
referringTo: {
path: Path.Distinctive<Partitioned<Partition>>;
username?: string;
}; name: string;
}): Promise<this>;write(
path: Path.Distinctive<Partitioned<Partition>>,
content: ,
| Uint8Array
| SoftLink
| SoftLink[]
| Record<string, SoftLink>
options?: MutationOptions,
): Promise<this>;§Constructors
§Properties
§
eventEmitter: EventEmitter<Events.FileSystem>
[src]§Methods
§
checkMutationPermissionAndAddProof(path: DistinctivePath<Partitioned<Partition>>, isMutation: boolean): Promise<void>
[src]§
deactivate(): void
[src]Deactivate a file system.
Use this when a user signs out. The only function of this is to stop listing to online/offline events.
§
exists(path: Path.Distinctive<PartitionedNonEmpty<Partition>>): Promise<boolean>
[src]§
get(path: Path.Distinctive<Partitioned<Partition>>): Promise<PuttableUnixTree | File | null>
[src]§
historyStep(): Promise<void>
[src]Ensures the current version of your file system is "committed" and stepped forward, so the current version will always be persisted as an "step" in the history of the file system.
This function is implicitly called every time your file system changes are synced, so in most cases calling this is handled for you.
§
ls(path: Path.Directory<Partitioned<Partition>>): Promise<Links>
[src]§
mkdir(path: Path.Directory<PartitionedNonEmpty<Partition>>, options?: MutationOptions): Promise<this>
[src]§
mv(from: Path.Distinctive<PartitionedNonEmpty<Partition>>, to: Path.Distinctive<PartitionedNonEmpty<Partition>>): Promise<this>
[src]§
resolveSymlink(link: SoftLink): Promise<File | Tree | null>
[src]Resolve a symlink directly.
The get
and cat
methods will automatically resolve symlinks,
but sometimes when working with symlinks directly
you might want to use this method instead.
§
runMutationOnNode(path: DistinctivePath<Partitioned<Partition>>, handlers: {
[src]public(root: UnixTree, relPath: Path.Segments): Promise<void>;
private(node: PrivateTree | PrivateFile, relPath: Path.Segments): Promise<void>;
}): Promise<void>§
runOnChildTree(node: Tree, relPath: Path.Segments, fn: (tree: Tree) => Promise<Tree>): Promise<Tree>
[src]§
runOnNode<A>(path: DistinctivePath<Partitioned<Partition>>, handlers: {
[src]public(root: UnixTree, relPath: Path.Segments): Promise<A>;
private(node: Tree | File, relPath: Path.Segments): Promise<A>;
}): Promise<A>§
symlink(args: {
[src]at: Path.Directory<Partitioned<Partition>>;
referringTo: {
path: Path.Distinctive<Partitioned<Partition>>;
username?: string;
}; name: string;
}): Promise<this>Make a symbolic link at a path.
§
write(path: Path.Distinctive<Partitioned<Partition>>, content: Uint8Array | SoftLink | SoftLink[] | Record<string, SoftLink>, options?: MutationOptions): Promise<this>
[src]§Static Methods
§
empty(opts: NewFileSystemOptions): Promise<FileSystem>
[src]Creates a file system with an empty public tree & an empty private tree at the root.