-
Notifications
You must be signed in to change notification settings - Fork 67
Custom File System [v2]
You can create your custom FileSystem
and mount it on the server. Your custom file system MUST extends the FileSystem
class to implement all required methods.
The FileSystem
class is very huge and wrap a lot of functionalities, but the choice of what to override is yours. If you don't implement a method, its default behaviour will be used instead.
You don't need to override any other method than the ones starting with the an underscore (_
). For some of the methods, the default behaviour is to return (in the callback) an InvalidOperation
error.
Here is the list of these overridable methods :
abstract class FileSystem implements ISerializableFileSystem
{
protected _fastExistCheck?(ctx : RequestContext, path : Path, callback : (exists : boolean) => void) : void
protected _create?(path : Path, ctx : CreateInfo, callback : SimpleCallback) : void
protected _etag?(path : Path, ctx : ETagInfo, callback : ReturnCallback<string>) : void
protected _delete?(path : Path, ctx : DeleteInfo, callback : SimpleCallback) : void
protected _openWriteStream?(path : Path, ctx : OpenWriteStreamInfo, callback : ReturnCallback<Writable>) : void
protected _openReadStream?(path : Path, ctx : OpenReadStreamInfo, callback : ReturnCallback<Readable>) : void
protected _move?(pathFrom : Path, pathTo : Path, ctx : MoveInfo, callback : ReturnCallback<boolean>) : void
protected _copy?(pathFrom : Path, pathTo : Path, ctx : CopyInfo, callback : ReturnCallback<boolean>) : void
protected _rename?(pathFrom : Path, newName : string, ctx : RenameInfo, callback : ReturnCallback<boolean>) : void
protected _mimeType?(path : Path, ctx : MimeTypeInfo, callback : ReturnCallback<string>) : void
protected _size?(path : Path, ctx : SizeInfo, callback : ReturnCallback<number>) : void
protected _availableLocks?(path : Path, ctx : AvailableLocksInfo, callback : ReturnCallback<LockKind[]>) : void
protected abstract _lockManager(path : Path, ctx : LockManagerInfo, callback : ReturnCallback<ILockManager>) : void
protected abstract _propertyManager(path : Path, ctx : PropertyManagerInfo, callback : ReturnCallback<IPropertyManager>) : void
protected _readDir?(path : Path, ctx : ReadDirInfo, callback : ReturnCallback<string[] | Path[]>) : void
protected _creationDate?(path : Path, ctx : CreationDateInfo, callback : ReturnCallback<number>) : void
protected _lastModifiedDate?(path : Path, ctx : LastModifiedDateInfo, callback : ReturnCallback<number>) : void
protected _displayName?(path : Path, ctx : DisplayNameInfo, callback : ReturnCallback<string>) : void
protected abstract _type(path : Path, ctx : TypeInfo, callback : ReturnCallback<ResourceType>) : void
protected _privilegeManager?(path : Path, info : PrivilegeManagerInfo, callback : ReturnCallback<PrivilegeManager>)
}
The abstract
methods MUST be written. There is no default behaviour if there are not present, therefore, they are mandatory.
The methods ending with the question mark (?
) are optional and might not be implemented.
abstract class FileSystem implements ISerializableFileSystem
{
constructor(serializer : FileSystemSerializer);
serializer() : FileSystemSerializer;
contextualize(ctx : RequestContext) : ContextualFileSystem;
resource(ctx : RequestContext, path : Path) : Resource;
fastExistCheckEx(ctx : RequestContext, _path : Path | string, errorCallback : SimpleCallback, callback : () => void) : void;
fastExistCheckExReverse(ctx : RequestContext, _path : Path | string, errorCallback : SimpleCallback, callback : () => void) : void;
protected fastExistCheck(ctx : RequestContext, _path : Path | string, callback : (exists : boolean) => void) : void;
protected _fastExistCheck?(ctx : RequestContext, path : Path, callback : (exists : boolean) => void) : void
create(ctx : RequestContext, path : Path | string, type : ResourceType, callback : SimpleCallback) : void
create(ctx : RequestContext, path : Path | string, type : ResourceType, createIntermediates : boolean, callback : SimpleCallback) : void;
protected _create?(path : Path, ctx : CreateInfo, callback : SimpleCallback) : void
etag(ctx : RequestContext, _path : Path | string, callback : ReturnCallback<string>) : void;
protected _etag?(path : Path, ctx : ETagInfo, callback : ReturnCallback<string>) : void
delete(ctx : RequestContext, path : Path | string, callback : SimpleCallback) : void
delete(ctx : RequestContext, path : Path | string, depth : number, callback : SimpleCallback) : void;
protected _delete?(path : Path, ctx : DeleteInfo, callback : SimpleCallback) : void
openWriteStream(ctx : RequestContext, path : Path | string, callback : Return2Callback<Writable, boolean>) : void
openWriteStream(ctx : RequestContext, path : Path | string, estimatedSize : number, callback : Return2Callback<Writable, boolean>) : void
openWriteStream(ctx : RequestContext, path : Path | string, targetSource : boolean, callback : Return2Callback<Writable, boolean>) : void
openWriteStream(ctx : RequestContext, path : Path | string, targetSource : boolean, estimatedSize : number, callback : Return2Callback<Writable, boolean>) : void
openWriteStream(ctx : RequestContext, path : Path | string, mode : OpenWriteStreamMode, callback : Return2Callback<Writable, boolean>) : void
openWriteStream(ctx : RequestContext, path : Path | string, mode : OpenWriteStreamMode, estimatedSize : number, callback : Return2Callback<Writable, boolean>) : void
openWriteStream(ctx : RequestContext, path : Path | string, mode : OpenWriteStreamMode, targetSource : boolean, callback : Return2Callback<Writable, boolean>) : void
openWriteStream(ctx : RequestContext, path : Path | string, mode : OpenWriteStreamMode, targetSource : boolean, estimatedSize : number, callback : Return2Callback<Writable, boolean>) : void;
protected _openWriteStream?(path : Path, ctx : OpenWriteStreamInfo, callback : ReturnCallback<Writable>) : void
openReadStream(ctx : RequestContext, path : Path | string, callback : ReturnCallback<Readable>) : void
openReadStream(ctx : RequestContext, path : Path | string, estimatedSize : number, callback : ReturnCallback<Readable>) : void
openReadStream(ctx : RequestContext, path : Path | string, targetSource : boolean, callback : ReturnCallback<Readable>) : void
openReadStream(ctx : RequestContext, path : Path | string, targetSource : boolean, estimatedSize : number, callback : ReturnCallback<Readable>) : void;
protected _openReadStream?(path : Path, ctx : OpenReadStreamInfo, callback : ReturnCallback<Readable>) : void
move(ctx : RequestContext, pathFrom : Path | string, pathTo : Path | string, callback : ReturnCallback<boolean>) : void
move(ctx : RequestContext, pathFrom : Path | string, pathTo : Path | string, overwrite : boolean, callback : ReturnCallback<boolean>) : void;
protected _move?(pathFrom : Path, pathTo : Path, ctx : MoveInfo, callback : ReturnCallback<boolean>) : void
copy(ctx : RequestContext, pathFrom : Path | string, pathTo : Path | string, callback : ReturnCallback<boolean>) : void
copy(ctx : RequestContext, pathFrom : Path | string, pathTo : Path | string, depth : number, callback : ReturnCallback<boolean>) : void
copy(ctx : RequestContext, pathFrom : Path | string, pathTo : Path | string, overwrite : boolean, callback : ReturnCallback<boolean>) : void
copy(ctx : RequestContext, pathFrom : Path | string, pathTo : Path | string, overwrite : boolean, depth : number, callback : ReturnCallback<boolean>) : void;
protected _copy?(pathFrom : Path, pathTo : Path, ctx : CopyInfo, callback : ReturnCallback<boolean>) : void
rename(ctx : RequestContext, pathFrom : Path | string, newName : string, callback : ReturnCallback<boolean>) : void
rename(ctx : RequestContext, pathFrom : Path | string, newName : string, overwrite : boolean, callback : ReturnCallback<boolean>) : void;
protected _rename?(pathFrom : Path, newName : string, ctx : RenameInfo, callback : ReturnCallback<boolean>) : void
mimeType(ctx : RequestContext, path : Path | string, callback : ReturnCallback<string>) : void
mimeType(ctx : RequestContext, path : Path | string, targetSource : boolean, callback : ReturnCallback<string>) : void;
protected _mimeType?(path : Path, ctx : MimeTypeInfo, callback : ReturnCallback<string>) : void
size(ctx : RequestContext, path : Path | string, callback : ReturnCallback<number>) : void
size(ctx : RequestContext, path : Path | string, targetSource : boolean, callback : ReturnCallback<number>) : void;
protected _size?(path : Path, ctx : SizeInfo, callback : ReturnCallback<number>) : void
availableLocks(ctx : RequestContext, path : Path | string, callback : ReturnCallback<LockKind[]>) : void;
protected _availableLocks?(path : Path, ctx : AvailableLocksInfo, callback : ReturnCallback<LockKind[]>) : void
lockManager(ctx : RequestContext, path : Path | string, callback : ReturnCallback<ILockManager>) : void;
protected abstract _lockManager(path : Path, ctx : LockManagerInfo, callback : ReturnCallback<ILockManager>) : void
propertyManager(ctx : RequestContext, path : Path | string, callback : ReturnCallback<IPropertyManager>) : void;
protected abstract _propertyManager(path : Path, ctx : PropertyManagerInfo, callback : ReturnCallback<IPropertyManager>) : void
readDir(ctx : RequestContext, path : Path | string, callback : ReturnCallback<string[]>) : void
readDir(ctx : RequestContext, path : Path | string, retrieveExternalFiles : boolean, callback : ReturnCallback<string[]>) : void;
protected _readDir?(path : Path, ctx : ReadDirInfo, callback : ReturnCallback<string[] | Path[]>) : void
creationDate(ctx : RequestContext, path : Path | string, callback : ReturnCallback<number>) : void;
protected _creationDate?(path : Path, ctx : CreationDateInfo, callback : ReturnCallback<number>) : void
lastModifiedDate(ctx : RequestContext, path : Path | string, callback : ReturnCallback<number>) : void;
protected _lastModifiedDate?(path : Path, ctx : LastModifiedDateInfo, callback : ReturnCallback<number>) : void
webName(ctx : RequestContext, path : Path | string, callback : ReturnCallback<string>) : void;
displayName(ctx : RequestContext, path : Path | string, callback : ReturnCallback<string>) : void;
protected _displayName?(path : Path, ctx : DisplayNameInfo, callback : ReturnCallback<string>) : void
type(ctx : RequestContext, path : Path | string, callback : ReturnCallback<ResourceType>) : void;
protected abstract _type(path : Path, ctx : TypeInfo, callback : ReturnCallback<ResourceType>) : void
addSubTree(ctx : RequestContext, subTree : SubTree, callback : SimpleCallback)
addSubTree(ctx : RequestContext, resourceType : ResourceType, callback : SimpleCallback)
addSubTree(ctx : RequestContext, rootPath : Path | string, subTree : SubTree, callback : SimpleCallback)
addSubTree(ctx : RequestContext, rootPath : Path | string, resourceType : ResourceType, callback : SimpleCallback);
listDeepLocks(ctx : RequestContext, startPath : Path | string, callback : ReturnCallback<{ [path : string] : Lock[] }>)
listDeepLocks(ctx : RequestContext, startPath : Path | string, depth : number, callback : ReturnCallback<{ [path : string] : Lock[] }>);
getFullPath(ctx : RequestContext, callback : ReturnCallback<Path>)
getFullPath(ctx : RequestContext, path : Path | string, callback : ReturnCallback<Path>);
localize(ctx : RequestContext, fullPath : Path, callback : ReturnCallback<Path[]>)
localize(ctx : RequestContext, fullPath : Path[], callback : ReturnCallback<Path[]>)
localize(ctx : RequestContext, fullPath : string, callback : ReturnCallback<Path[]>)
localize(ctx : RequestContext, fullPath : string[], callback : ReturnCallback<Path[]>)
localize(ctx : RequestContext, fullPath : (string | Path)[], callback : ReturnCallback<Path[]>);
checkPrivilege(ctx : RequestContext, path : Path | string, privilege : BasicPrivilege, callback : ReturnCallback<boolean>)
checkPrivilege(ctx : RequestContext, path : Path | string, privileges : BasicPrivilege[], callback : ReturnCallback<boolean>)
checkPrivilege(ctx : RequestContext, path : Path | string, privilege : string, callback : ReturnCallback<boolean>)
checkPrivilege(ctx : RequestContext, path : Path | string, privileges : string[], callback : ReturnCallback<boolean>)
checkPrivilege(ctx : RequestContext, path : Path | string, privileges : BasicPrivilege | BasicPrivilege[], callback : ReturnCallback<boolean>)
checkPrivilege(ctx : RequestContext, path : Path | string, privileges : string | string[], callback : ReturnCallback<boolean>);
privilegeManager(ctx : RequestContext, path : Path | string, callback : ReturnCallback<PrivilegeManager>);
protected _privilegeManager?(path : Path, info : PrivilegeManagerInfo, callback : ReturnCallback<PrivilegeManager>)
isLocked(ctx : RequestContext, path : Path | string, callback : ReturnCallback<boolean>);
serialize(callback : ReturnCallback<any>) : void;
}
- Home
- Version 2
- Install
- Quick Start Guide
- Examples
- Concepts
- User concepts
- Server concepts
- Customizing
- Version 1 [Obsolete]
- Install
- Quick Start Guide
- Examples
- Features
- Resource concepts
- User concepts
- Server concepts
- Customizing
- Project