최예리

이미지 업로드 구현 성공

폴더 생성, 수정, 삭제 개선
1 +node_modules
...\ No newline at end of file ...\ No newline at end of file
1 +Copyright Joyent, Inc. and other Node contributors. All rights reserved.
2 +Permission is hereby granted, free of charge, to any person obtaining a copy
3 +of this software and associated documentation files (the "Software"), to
4 +deal in the Software without restriction, including without limitation the
5 +rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
6 +sell copies of the Software, and to permit persons to whom the Software is
7 +furnished to do so, subject to the following conditions:
8 +
9 +The above copyright notice and this permission notice shall be included in
10 +all copies or substantial portions of the Software.
11 +
12 +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
13 +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
14 +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
15 +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
16 +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
17 +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
18 +IN THE SOFTWARE.
1 +# path
2 +
3 +This is an exact copy of the NodeJS ’path’ module published to the NPM registry.
4 +
5 +[Documentation](http://nodejs.org/docs/latest/api/path.html)
6 +
7 +## Install
8 +
9 +```sh
10 +$ npm install --save path
11 +```
12 +
13 +## License
14 +
15 +MIT
1 +{
2 + "_from": "path",
3 + "_id": "path@0.12.7",
4 + "_inBundle": false,
5 + "_integrity": "sha1-1NwqUGxM4hl+tIHr/NWzbAFAsQ8=",
6 + "_location": "/path",
7 + "_phantomChildren": {},
8 + "_requested": {
9 + "type": "tag",
10 + "registry": true,
11 + "raw": "path",
12 + "name": "path",
13 + "escapedName": "path",
14 + "rawSpec": "",
15 + "saveSpec": null,
16 + "fetchSpec": "latest"
17 + },
18 + "_requiredBy": [
19 + "#USER",
20 + "/"
21 + ],
22 + "_resolved": "https://registry.npmjs.org/path/-/path-0.12.7.tgz",
23 + "_shasum": "d4dc2a506c4ce2197eb481ebfcd5b36c0140b10f",
24 + "_spec": "path",
25 + "_where": "C:\\Users\\yeari\\Desktop\\경희대\\오픈소스SW개발\\Project\\OSS-Project",
26 + "author": {
27 + "name": "Joyent",
28 + "url": "http://www.joyent.com"
29 + },
30 + "bugs": {
31 + "url": "https://github.com/jinder/path/issues"
32 + },
33 + "bundleDependencies": false,
34 + "dependencies": {
35 + "process": "^0.11.1",
36 + "util": "^0.10.3"
37 + },
38 + "deprecated": false,
39 + "description": "Node.JS path module",
40 + "homepage": "http://nodejs.org/docs/latest/api/path.html",
41 + "keywords": [
42 + "ender",
43 + "path"
44 + ],
45 + "license": "MIT",
46 + "main": "./path.js",
47 + "name": "path",
48 + "repository": {
49 + "type": "git",
50 + "url": "git://github.com/jinder/path.git"
51 + },
52 + "version": "0.12.7"
53 +}
This diff is collapsed. Click to expand it.
1 +{
2 +extends: "eslint:recommended",
3 + "env": {
4 + "node": true,
5 + "browser": true,
6 + "es6" : true,
7 + "mocha": true
8 + },
9 + "rules": {
10 + "indent": [2, 4],
11 + "brace-style": [2, "1tbs"],
12 + "quotes": [2, "single"],
13 + "no-console": 0,
14 + "no-shadow": 0,
15 + "no-use-before-define": [2, "nofunc"],
16 + "no-underscore-dangle": 0,
17 + "no-constant-condition": 0,
18 + "space-after-function-name": 0,
19 + "consistent-return": 0
20 + }
21 +}
1 +(The MIT License)
2 +
3 +Copyright (c) 2013 Roman Shtylman <shtylman@gmail.com>
4 +
5 +Permission is hereby granted, free of charge, to any person obtaining
6 +a copy of this software and associated documentation files (the
7 +'Software'), to deal in the Software without restriction, including
8 +without limitation the rights to use, copy, modify, merge, publish,
9 +distribute, sublicense, and/or sell copies of the Software, and to
10 +permit persons to whom the Software is furnished to do so, subject to
11 +the following conditions:
12 +
13 +The above copyright notice and this permission notice shall be
14 +included in all copies or substantial portions of the Software.
15 +
16 +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
17 +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18 +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
19 +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
20 +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
21 +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
22 +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
1 +# process
2 +
3 +```require('process');``` just like any other module.
4 +
5 +Works in node.js and browsers via the browser.js shim provided with the module.
6 +
7 +## browser implementation
8 +
9 +The goal of this module is not to be a full-fledged alternative to the builtin process module. This module mostly exists to provide the nextTick functionality and little more. We keep this module lean because it will often be included by default by tools like browserify when it detects a module has used the `process` global.
10 +
11 +It also exposes a "browser" member (i.e. `process.browser`) which is `true` in this implementation but `undefined` in node. This can be used in isomorphic code that adjusts it's behavior depending on which environment it's running in.
12 +
13 +If you are looking to provide other process methods, I suggest you monkey patch them onto the process global in your app. A list of user created patches is below.
14 +
15 +* [hrtime](https://github.com/kumavis/browser-process-hrtime)
16 +* [stdout](https://github.com/kumavis/browser-stdout)
17 +
18 +## package manager notes
19 +
20 +If you are writing a bundler to package modules for client side use, make sure you use the ```browser``` field hint in package.json.
21 +
22 +See https://gist.github.com/4339901 for details.
23 +
24 +The [browserify](https://github.com/substack/node-browserify) module will properly handle this field when bundling your files.
25 +
26 +
1 +// shim for using process in browser
2 +var process = module.exports = {};
3 +
4 +// cached from whatever global is present so that test runners that stub it
5 +// don't break things. But we need to wrap it in a try catch in case it is
6 +// wrapped in strict mode code which doesn't define any globals. It's inside a
7 +// function because try/catches deoptimize in certain engines.
8 +
9 +var cachedSetTimeout;
10 +var cachedClearTimeout;
11 +
12 +function defaultSetTimout() {
13 + throw new Error('setTimeout has not been defined');
14 +}
15 +function defaultClearTimeout () {
16 + throw new Error('clearTimeout has not been defined');
17 +}
18 +(function () {
19 + try {
20 + if (typeof setTimeout === 'function') {
21 + cachedSetTimeout = setTimeout;
22 + } else {
23 + cachedSetTimeout = defaultSetTimout;
24 + }
25 + } catch (e) {
26 + cachedSetTimeout = defaultSetTimout;
27 + }
28 + try {
29 + if (typeof clearTimeout === 'function') {
30 + cachedClearTimeout = clearTimeout;
31 + } else {
32 + cachedClearTimeout = defaultClearTimeout;
33 + }
34 + } catch (e) {
35 + cachedClearTimeout = defaultClearTimeout;
36 + }
37 +} ())
38 +function runTimeout(fun) {
39 + if (cachedSetTimeout === setTimeout) {
40 + //normal enviroments in sane situations
41 + return setTimeout(fun, 0);
42 + }
43 + // if setTimeout wasn't available but was latter defined
44 + if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
45 + cachedSetTimeout = setTimeout;
46 + return setTimeout(fun, 0);
47 + }
48 + try {
49 + // when when somebody has screwed with setTimeout but no I.E. maddness
50 + return cachedSetTimeout(fun, 0);
51 + } catch(e){
52 + try {
53 + // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
54 + return cachedSetTimeout.call(null, fun, 0);
55 + } catch(e){
56 + // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error
57 + return cachedSetTimeout.call(this, fun, 0);
58 + }
59 + }
60 +
61 +
62 +}
63 +function runClearTimeout(marker) {
64 + if (cachedClearTimeout === clearTimeout) {
65 + //normal enviroments in sane situations
66 + return clearTimeout(marker);
67 + }
68 + // if clearTimeout wasn't available but was latter defined
69 + if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
70 + cachedClearTimeout = clearTimeout;
71 + return clearTimeout(marker);
72 + }
73 + try {
74 + // when when somebody has screwed with setTimeout but no I.E. maddness
75 + return cachedClearTimeout(marker);
76 + } catch (e){
77 + try {
78 + // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
79 + return cachedClearTimeout.call(null, marker);
80 + } catch (e){
81 + // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error.
82 + // Some versions of I.E. have different rules for clearTimeout vs setTimeout
83 + return cachedClearTimeout.call(this, marker);
84 + }
85 + }
86 +
87 +
88 +
89 +}
90 +var queue = [];
91 +var draining = false;
92 +var currentQueue;
93 +var queueIndex = -1;
94 +
95 +function cleanUpNextTick() {
96 + if (!draining || !currentQueue) {
97 + return;
98 + }
99 + draining = false;
100 + if (currentQueue.length) {
101 + queue = currentQueue.concat(queue);
102 + } else {
103 + queueIndex = -1;
104 + }
105 + if (queue.length) {
106 + drainQueue();
107 + }
108 +}
109 +
110 +function drainQueue() {
111 + if (draining) {
112 + return;
113 + }
114 + var timeout = runTimeout(cleanUpNextTick);
115 + draining = true;
116 +
117 + var len = queue.length;
118 + while(len) {
119 + currentQueue = queue;
120 + queue = [];
121 + while (++queueIndex < len) {
122 + if (currentQueue) {
123 + currentQueue[queueIndex].run();
124 + }
125 + }
126 + queueIndex = -1;
127 + len = queue.length;
128 + }
129 + currentQueue = null;
130 + draining = false;
131 + runClearTimeout(timeout);
132 +}
133 +
134 +process.nextTick = function (fun) {
135 + var args = new Array(arguments.length - 1);
136 + if (arguments.length > 1) {
137 + for (var i = 1; i < arguments.length; i++) {
138 + args[i - 1] = arguments[i];
139 + }
140 + }
141 + queue.push(new Item(fun, args));
142 + if (queue.length === 1 && !draining) {
143 + runTimeout(drainQueue);
144 + }
145 +};
146 +
147 +// v8 likes predictible objects
148 +function Item(fun, array) {
149 + this.fun = fun;
150 + this.array = array;
151 +}
152 +Item.prototype.run = function () {
153 + this.fun.apply(null, this.array);
154 +};
155 +process.title = 'browser';
156 +process.browser = true;
157 +process.env = {};
158 +process.argv = [];
159 +process.version = ''; // empty string to avoid regexp issues
160 +process.versions = {};
161 +
162 +function noop() {}
163 +
164 +process.on = noop;
165 +process.addListener = noop;
166 +process.once = noop;
167 +process.off = noop;
168 +process.removeListener = noop;
169 +process.removeAllListeners = noop;
170 +process.emit = noop;
171 +process.prependListener = noop;
172 +process.prependOnceListener = noop;
173 +
174 +process.listeners = function (name) { return [] }
175 +
176 +process.binding = function (name) {
177 + throw new Error('process.binding is not supported');
178 +};
179 +
180 +process.cwd = function () { return '/' };
181 +process.chdir = function (dir) {
182 + throw new Error('process.chdir is not supported');
183 +};
184 +process.umask = function() { return 0; };
1 +// for now just expose the builtin process global from node.js
2 +module.exports = global.process;
1 +{
2 + "_from": "process@^0.11.1",
3 + "_id": "process@0.11.10",
4 + "_inBundle": false,
5 + "_integrity": "sha1-czIwDoQBYb2j5podHZGn1LwW8YI=",
6 + "_location": "/process",
7 + "_phantomChildren": {},
8 + "_requested": {
9 + "type": "range",
10 + "registry": true,
11 + "raw": "process@^0.11.1",
12 + "name": "process",
13 + "escapedName": "process",
14 + "rawSpec": "^0.11.1",
15 + "saveSpec": null,
16 + "fetchSpec": "^0.11.1"
17 + },
18 + "_requiredBy": [
19 + "/path"
20 + ],
21 + "_resolved": "https://registry.npmjs.org/process/-/process-0.11.10.tgz",
22 + "_shasum": "7332300e840161bda3e69a1d1d91a7d4bc16f182",
23 + "_spec": "process@^0.11.1",
24 + "_where": "C:\\Users\\yeari\\Desktop\\경희대\\오픈소스SW개발\\Project\\OSS-Project\\node_modules\\path",
25 + "author": {
26 + "name": "Roman Shtylman",
27 + "email": "shtylman@gmail.com"
28 + },
29 + "browser": "./browser.js",
30 + "bugs": {
31 + "url": "https://github.com/shtylman/node-process/issues"
32 + },
33 + "bundleDependencies": false,
34 + "deprecated": false,
35 + "description": "process information for node.js and browsers",
36 + "devDependencies": {
37 + "mocha": "2.2.1",
38 + "zuul": "^3.10.3"
39 + },
40 + "engines": {
41 + "node": ">= 0.6.0"
42 + },
43 + "homepage": "https://github.com/shtylman/node-process#readme",
44 + "keywords": [
45 + "process"
46 + ],
47 + "license": "MIT",
48 + "main": "./index.js",
49 + "name": "process",
50 + "repository": {
51 + "type": "git",
52 + "url": "git://github.com/shtylman/node-process.git"
53 + },
54 + "scripts": {
55 + "browser": "zuul --no-coverage --ui mocha-bdd --local 8080 -- test.js",
56 + "test": "mocha test.js"
57 + },
58 + "version": "0.11.10"
59 +}
1 +var assert = require('assert');
2 +var ourProcess = require('./browser');
3 +describe('test against our process', function () {
4 + test(ourProcess);
5 +});
6 +if (!process.browser) {
7 + describe('test against node', function () {
8 + test(process);
9 + });
10 + vmtest();
11 +}
12 +function test (ourProcess) {
13 + describe('test arguments', function () {
14 + it ('works', function (done) {
15 + var order = 0;
16 +
17 +
18 + ourProcess.nextTick(function (num) {
19 + assert.equal(num, order++, 'first one works');
20 + ourProcess.nextTick(function (num) {
21 + assert.equal(num, order++, 'recursive one is 4th');
22 + }, 3);
23 + }, 0);
24 + ourProcess.nextTick(function (num) {
25 + assert.equal(num, order++, 'second one starts');
26 + ourProcess.nextTick(function (num) {
27 + assert.equal(num, order++, 'this is third');
28 + ourProcess.nextTick(function (num) {
29 + assert.equal(num, order++, 'this is last');
30 + done();
31 + }, 5);
32 + }, 4);
33 + }, 1);
34 + ourProcess.nextTick(function (num) {
35 +
36 + assert.equal(num, order++, '3rd schedualed happens after the error');
37 + }, 2);
38 + });
39 + });
40 +if (!process.browser) {
41 + describe('test errors', function (t) {
42 + it ('works', function (done) {
43 + var order = 0;
44 + process.removeAllListeners('uncaughtException');
45 + process.once('uncaughtException', function(err) {
46 + assert.equal(2, order++, 'error is third');
47 + ourProcess.nextTick(function () {
48 + assert.equal(5, order++, 'schedualed in error is last');
49 + done();
50 + });
51 + });
52 + ourProcess.nextTick(function () {
53 + assert.equal(0, order++, 'first one works');
54 + ourProcess.nextTick(function () {
55 + assert.equal(4, order++, 'recursive one is 4th');
56 + });
57 + });
58 + ourProcess.nextTick(function () {
59 + assert.equal(1, order++, 'second one starts');
60 + throw(new Error('an error is thrown'));
61 + });
62 + ourProcess.nextTick(function () {
63 + assert.equal(3, order++, '3rd schedualed happens after the error');
64 + });
65 + });
66 + });
67 +}
68 + describe('rename globals', function (t) {
69 + var oldTimeout = setTimeout;
70 + var oldClear = clearTimeout;
71 +
72 + it('clearTimeout', function (done){
73 +
74 + var ok = true;
75 + clearTimeout = function () {
76 + ok = false;
77 + }
78 + var ran = false;
79 + function cleanup() {
80 + clearTimeout = oldClear;
81 + var err;
82 + try {
83 + assert.ok(ok, 'fake clearTimeout ran');
84 + assert.ok(ran, 'should have run');
85 + } catch (e) {
86 + err = e;
87 + }
88 + done(err);
89 + }
90 + setTimeout(cleanup, 1000);
91 + ourProcess.nextTick(function () {
92 + ran = true;
93 + });
94 + });
95 + it('just setTimeout', function (done){
96 +
97 +
98 + setTimeout = function () {
99 + setTimeout = oldTimeout;
100 + try {
101 + assert.ok(false, 'fake setTimeout called')
102 + } catch (e) {
103 + done(e);
104 + }
105 +
106 + }
107 +
108 + ourProcess.nextTick(function () {
109 + setTimeout = oldTimeout;
110 + done();
111 + });
112 + });
113 + });
114 +}
115 +function vmtest() {
116 + var vm = require('vm');
117 + var fs = require('fs');
118 + var process = fs.readFileSync('./browser.js', {encoding: 'utf8'});
119 +
120 +
121 + describe('should work in vm in strict mode with no globals', function () {
122 + it('should parse', function (done) {
123 + var str = '"use strict";var module = {exports:{}};';
124 + str += process;
125 + str += 'this.works = process.browser;';
126 + var script = new vm.Script(str);
127 + var context = {
128 + works: false
129 + };
130 + script.runInNewContext(context);
131 + assert.ok(context.works);
132 + done();
133 + });
134 + it('setTimeout throws error', function (done) {
135 + var str = '"use strict";var module = {exports:{}};';
136 + str += process;
137 + str += 'try {process.nextTick(function () {})} catch (e){this.works = e;}';
138 + var script = new vm.Script(str);
139 + var context = {
140 + works: false
141 + };
142 + script.runInNewContext(context);
143 + assert.ok(context.works);
144 + done();
145 + });
146 + it('should generally work', function (done) {
147 + var str = '"use strict";var module = {exports:{}};';
148 + str += process;
149 + str += 'process.nextTick(function () {assert.ok(true);done();})';
150 + var script = new vm.Script(str);
151 + var context = {
152 + clearTimeout: clearTimeout,
153 + setTimeout: setTimeout,
154 + done: done,
155 + assert: assert
156 + };
157 + script.runInNewContext(context);
158 + });
159 + it('late defs setTimeout', function (done) {
160 + var str = '"use strict";var module = {exports:{}};';
161 + str += process;
162 + str += 'var setTimeout = hiddenSetTimeout;process.nextTick(function () {assert.ok(true);done();})';
163 + var script = new vm.Script(str);
164 + var context = {
165 + clearTimeout: clearTimeout,
166 + hiddenSetTimeout: setTimeout,
167 + done: done,
168 + assert: assert
169 + };
170 + script.runInNewContext(context);
171 + });
172 + it('late defs clearTimeout', function (done) {
173 + var str = '"use strict";var module = {exports:{}};';
174 + str += process;
175 + str += 'var clearTimeout = hiddenClearTimeout;process.nextTick(function () {assert.ok(true);done();})';
176 + var script = new vm.Script(str);
177 + var context = {
178 + hiddenClearTimeout: clearTimeout,
179 + setTimeout: setTimeout,
180 + done: done,
181 + assert: assert
182 + };
183 + script.runInNewContext(context);
184 + });
185 + it('late defs setTimeout and then redefine', function (done) {
186 + var str = '"use strict";var module = {exports:{}};';
187 + str += process;
188 + str += 'var setTimeout = hiddenSetTimeout;process.nextTick(function () {setTimeout = function (){throw new Error("foo")};hiddenSetTimeout(function(){process.nextTick(function (){assert.ok(true);done();});});});';
189 + var script = new vm.Script(str);
190 + var context = {
191 + clearTimeout: clearTimeout,
192 + hiddenSetTimeout: setTimeout,
193 + done: done,
194 + assert: assert
195 + };
196 + script.runInNewContext(context);
197 + });
198 + });
199 +}
1 +Copyright Joyent, Inc. and other Node contributors. All rights reserved.
2 +Permission is hereby granted, free of charge, to any person obtaining a copy
3 +of this software and associated documentation files (the "Software"), to
4 +deal in the Software without restriction, including without limitation the
5 +rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
6 +sell copies of the Software, and to permit persons to whom the Software is
7 +furnished to do so, subject to the following conditions:
8 +
9 +The above copyright notice and this permission notice shall be included in
10 +all copies or substantial portions of the Software.
11 +
12 +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
13 +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
14 +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
15 +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
16 +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
17 +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
18 +IN THE SOFTWARE.
1 +# util
2 +
3 +[![Build Status](https://travis-ci.org/defunctzombie/node-util.png?branch=master)](https://travis-ci.org/defunctzombie/node-util)
4 +
5 +node.js [util](http://nodejs.org/api/util.html) module as a module
6 +
7 +## install via [npm](npmjs.org)
8 +
9 +```shell
10 +npm install util
11 +```
12 +
13 +## browser support
14 +
15 +This module also works in modern browsers. If you need legacy browser support you will need to polyfill ES5 features.
1 +{
2 + "_from": "util@^0.10.3",
3 + "_id": "util@0.10.4",
4 + "_inBundle": false,
5 + "_integrity": "sha512-0Pm9hTQ3se5ll1XihRic3FDIku70C+iHUdT/W926rSgHV5QgXsYbKZN8MSC3tJtSkhuROzvsQjAaFENRXr+19A==",
6 + "_location": "/util",
7 + "_phantomChildren": {},
8 + "_requested": {
9 + "type": "range",
10 + "registry": true,
11 + "raw": "util@^0.10.3",
12 + "name": "util",
13 + "escapedName": "util",
14 + "rawSpec": "^0.10.3",
15 + "saveSpec": null,
16 + "fetchSpec": "^0.10.3"
17 + },
18 + "_requiredBy": [
19 + "/path"
20 + ],
21 + "_resolved": "https://registry.npmjs.org/util/-/util-0.10.4.tgz",
22 + "_shasum": "3aa0125bfe668a4672de58857d3ace27ecb76901",
23 + "_spec": "util@^0.10.3",
24 + "_where": "C:\\Users\\yeari\\Desktop\\경희대\\오픈소스SW개발\\Project\\OSS-Project\\node_modules\\path",
25 + "author": {
26 + "name": "Joyent",
27 + "url": "http://www.joyent.com"
28 + },
29 + "browser": {
30 + "./support/isBuffer.js": "./support/isBufferBrowser.js"
31 + },
32 + "bugs": {
33 + "url": "https://github.com/defunctzombie/node-util/issues"
34 + },
35 + "bundleDependencies": false,
36 + "dependencies": {
37 + "inherits": "2.0.3"
38 + },
39 + "deprecated": false,
40 + "description": "Node.JS util module",
41 + "devDependencies": {
42 + "zuul": "~1.0.9"
43 + },
44 + "files": [
45 + "util.js",
46 + "support"
47 + ],
48 + "homepage": "https://github.com/defunctzombie/node-util",
49 + "keywords": [
50 + "util"
51 + ],
52 + "license": "MIT",
53 + "main": "./util.js",
54 + "name": "util",
55 + "repository": {
56 + "type": "git",
57 + "url": "git://github.com/defunctzombie/node-util.git"
58 + },
59 + "scripts": {
60 + "test": "node test/node/*.js && zuul test/browser/*.js"
61 + },
62 + "version": "0.10.4"
63 +}
1 +module.exports = function isBuffer(arg) {
2 + return arg instanceof Buffer;
3 +}
1 +module.exports = function isBuffer(arg) {
2 + return arg && typeof arg === 'object'
3 + && typeof arg.copy === 'function'
4 + && typeof arg.fill === 'function'
5 + && typeof arg.readUInt8 === 'function';
6 +}
...\ No newline at end of file ...\ No newline at end of file
This diff is collapsed. Click to expand it.
...@@ -585,6 +585,15 @@ ...@@ -585,6 +585,15 @@
585 "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz", 585 "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz",
586 "integrity": "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==" 586 "integrity": "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ=="
587 }, 587 },
588 + "path": {
589 + "version": "0.12.7",
590 + "resolved": "https://registry.npmjs.org/path/-/path-0.12.7.tgz",
591 + "integrity": "sha1-1NwqUGxM4hl+tIHr/NWzbAFAsQ8=",
592 + "requires": {
593 + "process": "^0.11.1",
594 + "util": "^0.10.3"
595 + }
596 + },
588 "path-parse": { 597 "path-parse": {
589 "version": "1.0.6", 598 "version": "1.0.6",
590 "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.6.tgz", 599 "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.6.tgz",
...@@ -595,6 +604,11 @@ ...@@ -595,6 +604,11 @@
595 "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz", 604 "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz",
596 "integrity": "sha1-32BBeABfUi8V60SQ5yR6G/qmf4w=" 605 "integrity": "sha1-32BBeABfUi8V60SQ5yR6G/qmf4w="
597 }, 606 },
607 + "process": {
608 + "version": "0.11.10",
609 + "resolved": "https://registry.npmjs.org/process/-/process-0.11.10.tgz",
610 + "integrity": "sha1-czIwDoQBYb2j5podHZGn1LwW8YI="
611 + },
598 "process-nextick-args": { 612 "process-nextick-args": {
599 "version": "2.0.1", 613 "version": "2.0.1",
600 "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz", 614 "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz",
...@@ -911,14 +925,21 @@ ...@@ -911,14 +925,21 @@
911 "uglify-to-browserify": { 925 "uglify-to-browserify": {
912 "version": "1.0.2", 926 "version": "1.0.2",
913 "resolved": "https://registry.npmjs.org/uglify-to-browserify/-/uglify-to-browserify-1.0.2.tgz", 927 "resolved": "https://registry.npmjs.org/uglify-to-browserify/-/uglify-to-browserify-1.0.2.tgz",
914 - "integrity": "sha1-bgkk1r2mta/jSeOabWMoUKD4grc=", 928 + "integrity": "sha1-bgkk1r2mta/jSeOabWMoUKD4grc="
915 - "optional": true
916 }, 929 },
917 "unpipe": { 930 "unpipe": {
918 "version": "1.0.0", 931 "version": "1.0.0",
919 "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", 932 "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz",
920 "integrity": "sha1-sr9O6FFKrmFltIF4KdIbLvSZBOw=" 933 "integrity": "sha1-sr9O6FFKrmFltIF4KdIbLvSZBOw="
921 }, 934 },
935 + "util": {
936 + "version": "0.10.4",
937 + "resolved": "https://registry.npmjs.org/util/-/util-0.10.4.tgz",
938 + "integrity": "sha512-0Pm9hTQ3se5ll1XihRic3FDIku70C+iHUdT/W926rSgHV5QgXsYbKZN8MSC3tJtSkhuROzvsQjAaFENRXr+19A==",
939 + "requires": {
940 + "inherits": "2.0.3"
941 + }
942 + },
922 "util-deprecate": { 943 "util-deprecate": {
923 "version": "1.0.2", 944 "version": "1.0.2",
924 "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", 945 "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz",
......
...@@ -2,8 +2,24 @@ ...@@ -2,8 +2,24 @@
2 2
3 const express = require('express'); 3 const express = require('express');
4 const multer = require('multer'); 4 const multer = require('multer');
5 +
6 +var storage = multer.diskStorage({
7 + destination: function (req, file, cb) {
8 + var dir = req.params.directoryName;
9 + cb(null, './tensorflow/data/' + dir + '/');
10 + },
11 + filename: function (req, file, cb) {
12 + cb(null, new Date().valueOf() + "_" + file.originalname);
13 + }
14 +});
15 +
16 +var upload = multer({
17 + storage: storage
18 +});
19 +
5 const bodyParser = require('body-parser'); 20 const bodyParser = require('body-parser');
6 const fs = require('fs'); 21 const fs = require('fs');
22 +const path = require('path');
7 23
8 const PORT = 8080; 24 const PORT = 8080;
9 const HOST = '0.0.0.0'; 25 const HOST = '0.0.0.0';
...@@ -23,12 +39,12 @@ app.use(bodyParser.urlencoded({extended:false})); ...@@ -23,12 +39,12 @@ app.use(bodyParser.urlencoded({extended:false}));
23 39
24 // Redirect Root to Home 40 // Redirect Root to Home
25 app.get('/', (req, res) => { 41 app.get('/', (req, res) => {
26 - res.redirect('/home'); 42 + res.redirect('./home/');
27 }); 43 });
28 44
29 45
30 // Main Page 46 // Main Page
31 -app.get('/home', (req, res) => { 47 +app.get('/home/', (req, res) => {
32 fs.readdir(dataFolder, function(error, filelist){ 48 fs.readdir(dataFolder, function(error, filelist){
33 if(error) 49 if(error)
34 console.log(error); 50 console.log(error);
...@@ -53,45 +69,50 @@ app.post('/directory_check', (req, res) => { ...@@ -53,45 +69,50 @@ app.post('/directory_check', (req, res) => {
53 { 69 {
54 // Make directory 70 // Make directory
55 fs.mkdirSync(dataFolder + '/' + dir); 71 fs.mkdirSync(dataFolder + '/' + dir);
56 - console.log('디렉토리: ' + dir + ' 생성 완료'); 72 + console.log('Directory Create: ' + dir);
57 - res.redirect('/home/' + dir); 73 + res.redirect('/home/' + dir + '/');
58 } 74 }
59 }); 75 });
60 76
61 77
62 // Basic Directory Page 78 // Basic Directory Page
63 -app.get('/home/:directoryName', (req, res) => { 79 +app.get('/home/:directoryName/', (req, res) => {
64 - 80 + // 아래 주석 처리된 코드는 화면에서 이미지를 보여주기 위한 코드
81 + // 그러나 client에게 이미지를 보여주기 위해서는 Amazon S3를 이용해야 함
82 + // 아직 Amazon S3 기능을 추가하지 못함
83 + // var directoryName = new String(req.params.directoryName);
84 + // var ImageList = new Array();
85 + // var Path = dataFolder + '/' + directoryName;
86 + // fs.readdirSync(Path).forEach(function(file,index){
87 + // var fileType = path.extname(file);
88 + // if(fileType == ".jpg" || fileType == ".jpeg") {
89 + // ImageList.push("." + Path + "/" + file);
90 + // }
91 + // });
92 + // res.render('directory', {FileList:ImageList});
93 + var directoryName = req.params.directoryName;
94 + res.render('directory', {directoryName:directoryName});
65 }); 95 });
66 96
67 97
68 // Image Upload Directory Page 98 // Image Upload Directory Page
69 -app.get('/home/:directoryName/upload', (req, res) => { 99 +app.post('/home/:directoryName/upload/', upload.array('userImage'), (req, res) => {
70 - var upload_data = multer({ dest: 'tensorflow/data/' + directoryName }); 100 + var directoryName = req.params.directoryName;
71 - upload_data.array('ImageData')
72 var imgFileArr = req.files; 101 var imgFileArr = req.files;
102 + console.log("files: " + req.files);
103 + res.redirect('/home/' + directoryName + '/');
73 }); 104 });
74 105
75 106
76 // Modify Directory name 107 // Modify Directory name
77 -app.get('/home/:directoryName/modify', (req, res) => { 108 +app.get('/home/:directoryName/modify/', (req, res) => {
78 // exist query.newName 109 // exist query.newName
79 - var directoryName = new String(req.params.directoryName); 110 + var directoryName = req.params.directoryName;
80 - var newName = new String(req.query.newName); 111 + var newName = req.query.newName;
81 if (req.query.newName) { 112 if (req.query.newName) {
82 - // modify Directory name and Files 113 + // modify Directory name
83 - var path = dataFolder + '/' + directoryName; 114 + var Path = dataFolder + '/' + directoryName;
84 - fs.readdirSync(path).forEach(function(file,index){ 115 + fs.rename(Path, dataFolder + '/' + newName, function (err) {
85 - var curPath = path + "/" + file;
86 - var fileNameArr = string.split("_");
87 - var newPath = path + "/" + newName + "_" + fileNameArr[1];
88 - fs.rename(curPath, newPath, function (err) {
89 - if (err) {
90 - console.log("File Rename error: " + err);
91 - }
92 - });
93 - });
94 - fs.rename(path, dataFolder + '/' + newName, function (err) {
95 if (err) { 116 if (err) {
96 console.log("Directory Rename error: " + err); 117 console.log("Directory Rename error: " + err);
97 } else { 118 } else {
...@@ -107,9 +128,9 @@ app.get('/home/:directoryName/modify', (req, res) => { ...@@ -107,9 +128,9 @@ app.get('/home/:directoryName/modify', (req, res) => {
107 128
108 129
109 // Delete Directory 130 // Delete Directory
110 -app.get('/home/:directoryName/delete', (req, res) => { 131 +app.get('/home/:directoryName/delete/', (req, res) => {
111 // exist query.real 132 // exist query.real
112 - var directoryName = new String(req.params.directoryName); 133 + var directoryName = req.params.directoryName;
113 if (req.query.real) { 134 if (req.query.real) {
114 // Remove Directory and Files 135 // Remove Directory and Files
115 var path = dataFolder + '/' + directoryName; 136 var path = dataFolder + '/' + directoryName;
...@@ -118,6 +139,7 @@ app.get('/home/:directoryName/delete', (req, res) => { ...@@ -118,6 +139,7 @@ app.get('/home/:directoryName/delete', (req, res) => {
118 fs.unlinkSync(curPath); 139 fs.unlinkSync(curPath);
119 }); 140 });
120 fs.rmdirSync(path); 141 fs.rmdirSync(path);
142 + console.log('Directory Delete: ' + dir);
121 res.redirect('/'); 143 res.redirect('/');
122 } 144 }
123 else { 145 else {
......
...@@ -3,7 +3,27 @@ html ...@@ -3,7 +3,27 @@ html
3 head 3 head
4 meta(charset='utf-8') 4 meta(charset='utf-8')
5 title 파일 업로드 5 title 파일 업로드
6 +
7 + style
8 + img
9 + | display="block"
10 + | max-width="200px"
11 + | max-height="200px"
12 + | width="auto"
13 + | height="auto"
14 +
15 +
6 body 16 body
7 - form(action="upload" method="POST" enctype="multipart/form-data")
8 - input(type="file", name="userfile[]", multiple="multiple")
9 - input(type="submit", value="전송")
...\ No newline at end of file ...\ No newline at end of file
17 + - var DirectoryName=directoryName;
18 + h1=DirectoryName
19 + h2 파일 업로드
20 + br
21 + br
22 + form(action="./upload/" method="POST" enctype="multipart/form-data")
23 + input(type="file", name="userImage", multiple="multiple", accept=".jpg, .jpeg")
24 + input(type="submit", value="업로드")
25 + br
26 + //- var ImageList=FileList
27 + each Image in ImageList
28 + div(style="margin-right:10px; float:left;")
29 + img(src=Image)
...\ No newline at end of file ...\ No newline at end of file
......
1 script. 1 script.
2 var directoryName= !{directoryName}; 2 var directoryName= !{directoryName};
3 confirm('모든 이미지가 삭제됩니다.\n정말 ' + directoryName + ' 분류를 삭제하시겠습니까?') 3 confirm('모든 이미지가 삭제됩니다.\n정말 ' + directoryName + ' 분류를 삭제하시겠습니까?')
4 - ? location.href = location + 'real=true' : history.back();
...\ No newline at end of file ...\ No newline at end of file
4 + ? location.href ='.?real=true' : history.back();
...\ No newline at end of file ...\ No newline at end of file
......
...@@ -3,7 +3,7 @@ script. ...@@ -3,7 +3,7 @@ script.
3 var result = prompt('새 분류명을 입력하세요. (기존: ' + directoryName + ')'); 3 var result = prompt('새 분류명을 입력하세요. (기존: ' + directoryName + ')');
4 4
5 if (result) { 5 if (result) {
6 - location.href = location + 'newName=' + result; 6 + location.href = '.?newName=' + result;
7 } else { 7 } else {
8 alert('분류명을 수정하지 않습니다.'); 8 alert('분류명을 수정하지 않습니다.');
9 history.back(); 9 history.back();
......
1 -<script type="text/javascript">
2 -alert("이미 존재하는 분류입니다.");
3 -history.back();
4 -</script>
...@@ -7,14 +7,14 @@ html ...@@ -7,14 +7,14 @@ html
7 7
8 8
9 body 9 body
10 - form(action="directory_check" method="post") 10 + form(action="../directory_check" method="post")
11 p 새로 만들 분류명: 11 p 새로 만들 분류명:
12 input(name="directoryName", type="text") 12 input(name="directoryName", type="text")
13 input(type="submit", value="생성") 13 input(type="submit", value="생성")
14 br 14 br
15 15
16 16
17 - form(action="test" method="post" enctype="multipart/form-data") 17 + form(action="../test" method="post" enctype="multipart/form-data")
18 p 테스트할 이미지: 18 p 테스트할 이미지:
19 input(name="ImageTest", type="file") 19 input(name="ImageTest", type="file")
20 input(type="submit", value="테스트") 20 input(type="submit", value="테스트")
...@@ -26,13 +26,13 @@ html ...@@ -26,13 +26,13 @@ html
26 each folder in folderList 26 each folder in folderList
27 div(style="margin-right:30px; float:left;") 27 div(style="margin-right:30px; float:left;")
28 li 28 li
29 - a(href=location+folder)=folder 29 + a(href="./"+folder+"/")=folder
30 30
31 div(style="margin-right:5px; float:left;") 31 div(style="margin-right:5px; float:left;")
32 - form(action="home/"+folder+"/modify" method="get") 32 + form(action="./"+folder+"/modify/" method="get")
33 input(type="submit", value="수정") 33 input(type="submit", value="수정")
34 34
35 div 35 div
36 - form(action="home/"+folder+"/delete" method="get") 36 + form(action="./"+folder+"/delete/" method="get")
37 input(type="submit", value="삭제") 37 input(type="submit", value="삭제")
38 br 38 br
...\ No newline at end of file ...\ No newline at end of file
......