Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

files: implement MAX_FILES

  • Loading branch information...
commit d8365adb088a0e1e2b4af0ca62ee994e569af225 1 parent 027dc4d
@astro astro authored
Showing with 3 additions and 0 deletions.
  1. +3 −0  files.js
View
3  files.js
@@ -2,6 +2,7 @@ var fs = require('fs');
var DB_PATH = 'files.json';
var FILES_PATH = 'files';
+var MAX_FILES = 42;
var MAX_TOTAL_SIZE = 2048 * 1024 * 1024;
/* Keys: id, name, size, type, date, downloads */
@@ -77,6 +78,8 @@ exports.addFile = function(info) {
info.size = size;
files.unshift(info);
+ while(files.length > MAX_FILES)
+ that.dropFile();
writeInfo();
};
out.discard = function() {
Please sign in to comment.
Something went wrong with that request. Please try again.