Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a794f1e5b3 | ||
|
|
1b5d22a3ca | ||
|
|
4205caf7ac |
5
ftp-srv.d.ts
vendored
5
ftp-srv.d.ts
vendored
@@ -1,5 +1,6 @@
|
||||
import * as tls from 'tls'
|
||||
import { Stats } from 'fs'
|
||||
import { EventEmitter } from 'events';
|
||||
|
||||
export class FileSystem {
|
||||
|
||||
@@ -107,7 +108,7 @@ export class FtpServer {
|
||||
whitelist?: Array<string>
|
||||
}) => void,
|
||||
reject: (err?: Error) => void
|
||||
) => void)
|
||||
) => void): EventEmitter;
|
||||
|
||||
on(event: "client-error", listener: (
|
||||
data: {
|
||||
@@ -115,7 +116,7 @@ export class FtpServer {
|
||||
context: string,
|
||||
error: Error,
|
||||
}
|
||||
) => void)
|
||||
) => void): EventEmitter;
|
||||
}
|
||||
|
||||
export {FtpServer as FtpSrv};
|
||||
|
||||
@@ -9,7 +9,7 @@ module.exports = {
|
||||
if (isNaN(byteCount) || byteCount < 0) return this.reply(501, 'Byte count must be 0 or greater');
|
||||
|
||||
this.restByteCount = byteCount;
|
||||
return this.reply(350, `Resarting next transfer at ${byteCount}`);
|
||||
return this.reply(350, `Restarting next transfer at ${byteCount}`);
|
||||
},
|
||||
syntax: '{{cmd}} <byte-count>',
|
||||
description: 'Restart transfer from the specified point. Resets after any STORE or RETRIEVE'
|
||||
|
||||
@@ -18,7 +18,8 @@ module.exports = function (fileStat, format = 'ls') {
|
||||
function ls(fileStat) {
|
||||
const now = moment.utc();
|
||||
const mtime = moment.utc(new Date(fileStat.mtime));
|
||||
const dateFormat = now.diff(mtime, 'months') < 6 ? 'MMM DD HH:mm' : 'MMM DD YYYY';
|
||||
const timeDiff = now.diff(mtime, 'months');
|
||||
const dateFormat = timeDiff < 6 ? 'MMM DD HH:mm' : 'MMM DD YYYY';
|
||||
|
||||
return [
|
||||
fileStat.mode ? [
|
||||
|
||||
@@ -64,7 +64,7 @@ describe('Connector - Passive //', function () {
|
||||
return passive.setupServer()
|
||||
.then(shouldNotResolve)
|
||||
.catch(err => {
|
||||
expect(err.name).to.equal('RangeError');
|
||||
expect(err).to.be.instanceOf(RangeError);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -1,9 +1,20 @@
|
||||
const {expect} = require('chai');
|
||||
const sinon = require('sinon');
|
||||
const moment = require('moment');
|
||||
|
||||
const fileStat = require('../../src/helpers/file-stat');
|
||||
const errors = require('../../src/errors');
|
||||
|
||||
describe('helpers // file-stat', function () {
|
||||
let sandbox;
|
||||
|
||||
before(function () {
|
||||
sandbox = sinon.sandbox.create();
|
||||
});
|
||||
afterEach(function () {
|
||||
sandbox.restore();
|
||||
});
|
||||
|
||||
const STAT = {
|
||||
name: 'test1',
|
||||
dev: 2114,
|
||||
@@ -44,6 +55,11 @@ describe('helpers // file-stat', function () {
|
||||
|
||||
describe('format - ls //', function () {
|
||||
it('formats correctly', () => {
|
||||
const momentStub = sandbox.stub(moment, 'utc').callThrough();
|
||||
momentStub.onFirstCall().callsFake(function () {
|
||||
return moment.utc(new Date('Sept 10 2016'));
|
||||
});
|
||||
|
||||
const format = fileStat(STAT, 'ls');
|
||||
expect(format).to.equal('-rwxrwxrwx 1 85 100 527 Oct 10 23:24 test1');
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user