diff --git a/__tests__/adapters/vfs/system.js b/__tests__/adapters/vfs/system.js index 08e0fb0..319ceae 100644 --- a/__tests__/adapters/vfs/system.js +++ b/__tests__/adapters/vfs/system.js @@ -35,6 +35,15 @@ describe('VFS System adapter', () => { const request = (name, ...args) => adapter[name](vfs, vfs)(...args); + test('#capabilities', () => { + return expect(request('capabilities', '', createOptions())) + .resolves + .toMatchObject({ + pagination: false, + sort: false, + }); + }); + test('#touch', () => { return expect(request('touch', 'home:/test', createOptions())) .resolves diff --git a/src/adapters/vfs/system.js b/src/adapters/vfs/system.js index 0928aac..164a816 100644 --- a/src/adapters/vfs/system.js +++ b/src/adapters/vfs/system.js @@ -163,6 +163,18 @@ module.exports = (core) => { return watch; }, + /** + * Get filesystem capabilities + * @param {String} file The file path from client + * @param {Object} [options={}] Options + * @return {Object[]} + */ + capabilities: vfs => (file, options = {}) => + Promise.resolve({ + sort: false, + pagination: false + }), + /** * Checks if file exists * @param {String} file The file path from client diff --git a/src/vfs.js b/src/vfs.js index 65ecafb..a0c4b5b 100644 --- a/src/vfs.js +++ b/src/vfs.js @@ -235,6 +235,7 @@ const vfs = core => { // Wire up all available VFS events return { + capabilities: createRequest(requestPath, 'capabilities', false), realpath: createRequest(requestPath, 'realpath', false), exists: createRequest(requestPath, 'exists', false, respondBoolean), stat: createRequest(requestPath, 'stat', false), @@ -266,6 +267,7 @@ module.exports = core => { router.use(middleware); // Then all VFS routes (needs implementation above) + router.get('/capabilities', wrapper(methods.capabilities)); router.get('/exists', wrapper(methods.exists)); router.get('/stat', wrapper(methods.stat)); router.get('/readdir', wrapper(methods.readdir));