Skip to content

Commit 069161d

Browse files
author
mahsa shadi
committed
Add VFS capabilities method
1 parent 65dfdd5 commit 069161d

File tree

3 files changed

+22
-0
lines changed

3 files changed

+22
-0
lines changed

__tests__/adapters/vfs/system.js

+9
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,15 @@ describe('VFS System adapter', () => {
3535

3636
const request = (name, ...args) => adapter[name](vfs, vfs)(...args);
3737

38+
test('#capabilities', () => {
39+
return expect(request('capabilities', '', createOptions()))
40+
.resolves
41+
.toMatchObject({
42+
pagination: false,
43+
sort: false,
44+
});
45+
});
46+
3847
test('#touch', () => {
3948
return expect(request('touch', 'home:/test', createOptions()))
4049
.resolves

src/adapters/vfs/system.js

+11
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,17 @@ module.exports = (core) => {
162162

163163
return watch;
164164
},
165+
/**
166+
* Get filesystem capabilities
167+
* @param {String} file The file path from client
168+
* @param {Object} [options={}] Options
169+
* @return {Object[]}
170+
*/
171+
capabilities: vfs => (file, options = {}) =>
172+
Promise.resolve({
173+
sort:false,
174+
pagination:false
175+
}),
165176

166177
/**
167178
* Checks if file exists

src/vfs.js

+2
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,7 @@ const vfs = core => {
235235

236236
// Wire up all available VFS events
237237
return {
238+
capabilities: createRequest(requestPath, 'capabilities', false),
238239
realpath: createRequest(requestPath, 'realpath', false),
239240
exists: createRequest(requestPath, 'exists', false, respondBoolean),
240241
stat: createRequest(requestPath, 'stat', false),
@@ -266,6 +267,7 @@ module.exports = core => {
266267
router.use(middleware);
267268

268269
// Then all VFS routes (needs implementation above)
270+
router.get('/capabilities', wrapper(methods.capabilities));
269271
router.get('/exists', wrapper(methods.exists));
270272
router.get('/stat', wrapper(methods.stat));
271273
router.get('/readdir', wrapper(methods.readdir));

0 commit comments

Comments
 (0)