You've already forked joplin
mirror of
https://github.com/laurent22/joplin.git
synced 2025-06-15 23:00:36 +02:00
Changed export format extension to JEX and made it a non-compressed tar file
This commit is contained in:
@ -1,7 +1,8 @@
|
||||
const fs = require('fs-extra');
|
||||
const { time } = require('lib/time-utils.js');
|
||||
const FsDriverBase = require('lib/fs-driver-base');
|
||||
|
||||
class FsDriverNode {
|
||||
class FsDriverNode extends FsDriverBase {
|
||||
|
||||
fsErrorToJsError_(error, path = null) {
|
||||
let msg = error.toString();
|
||||
@ -81,9 +82,14 @@ class FsDriverNode {
|
||||
|
||||
async stat(path) {
|
||||
try {
|
||||
const s = await fs.stat(path);
|
||||
s.path = path;
|
||||
return s;
|
||||
const stat = await fs.stat(path);
|
||||
return {
|
||||
birthtime: stat.birthtime,
|
||||
mtime: stat.mtime,
|
||||
isDirectory: () => stat.isDirectory(),
|
||||
path: path,
|
||||
size: stat.size,
|
||||
};
|
||||
} catch (error) {
|
||||
if (error.code == 'ENOENT') return null;
|
||||
throw error;
|
||||
@ -94,14 +100,20 @@ class FsDriverNode {
|
||||
return fs.utimes(path, timestampDate, timestampDate);
|
||||
}
|
||||
|
||||
async readDirStats(path) {
|
||||
async readDirStats(path, options = null) {
|
||||
if (!options) options = {};
|
||||
if (!('recursive' in options)) options.recursive = false;
|
||||
|
||||
let items = await fs.readdir(path);
|
||||
let output = [];
|
||||
for (let i = 0; i < items.length; i++) {
|
||||
let stat = await this.stat(path + '/' + items[i]);
|
||||
const item = items[i];
|
||||
let stat = await this.stat(path + '/' + item);
|
||||
if (!stat) continue; // Has been deleted between the readdir() call and now
|
||||
stat.path = stat.path.substr(path.length + 1);
|
||||
output.push(stat);
|
||||
|
||||
output = await this.readDirStatsHandleRecursion_(path, stat, output, options);
|
||||
}
|
||||
return output;
|
||||
}
|
||||
|
Reference in New Issue
Block a user