Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Mihkel Putrinš
panustaja
Commits
f5cf50fe
Commit
f5cf50fe
authored
Nov 23, 2015
by
Mihkel Putrinš
Browse files
refactor
parent
17399253
Changes
2
Hide whitespace changes
Inline
Side-by-side
code/panu.js
View file @
f5cf50fe
...
...
@@ -116,21 +116,22 @@ function resourceLoaded() {
}
}
function
registerFile
(
parent_resource
,
_path
,
stats
,
callback
)
{
var
mimetype
=
mime
.
lookup
(
_path
)
resource_stats
.
files
.
count
++
resource_stats
.
files
.
size
+=
stats
.
size
op
.
push
(
parent_resource
,
'
files
'
,
_path
)
op
.
set
(
resource_stats
,
[
'
mime
'
,
mimetype
,
'
count
'
],
op
.
get
(
resource_stats
,
[
'
mime
'
,
mimetype
,
'
count
'
],
0
)
+
1
)
op
.
set
(
resource_stats
,
[
'
mime
'
,
mimetype
,
'
size
'
],
op
.
get
(
resource_stats
,
[
'
mime
'
,
mimetype
,
'
size
'
],
0
)
+
stats
.
size
)
callback
()
}
function
recurseLocal
(
parent_resource
,
paths
,
loadedCB
)
{
async
.
each
(
paths
,
function
iterator
(
_path
,
callback
)
{
fs
.
stat
(
_path
,
function
(
err
,
stats
)
{
if
(
err
)
{
return
callback
()
}
if
(
err
)
{
return
callback
()
}
if
(
stats
.
isFile
())
{
var
mimetype
=
mime
.
lookup
(
_path
)
// console.log(mimetype)
resource_stats
.
files
.
count
++
resource_stats
.
files
.
size
+=
stats
.
size
op
.
push
(
parent_resource
,
'
files
'
,
_path
)
op
.
set
(
resource_stats
,
[
'
mime
'
,
mimetype
,
'
count
'
],
op
.
get
(
resource_stats
,
[
'
mime
'
,
mimetype
,
'
count
'
],
0
)
+
1
)
op
.
set
(
resource_stats
,
[
'
mime
'
,
mimetype
,
'
size
'
],
op
.
get
(
resource_stats
,
[
'
mime
'
,
mimetype
,
'
size
'
],
0
)
+
stats
.
size
)
callback
()
registerFile
(
parent_resource
,
_path
,
stats
,
callback
)
}
else
if
(
stats
.
isDirectory
())
{
resource_stats
.
directories
.
count
++
var
directory
=
{
name
:
_path
}
...
...
package.json
View file @
f5cf50fe
...
...
@@ -2,7 +2,7 @@
"name"
:
"Panustaja"
,
"description"
:
"Ressursikataloogi upitamiseks keeleressurside Entu repositooriumisse."
,
"version"
:
"1.0.1-d"
,
"build"
:
10
0
,
"build"
:
10
1
,
"main"
:
"./code/app.js"
,
"license"
:
"CC-SA"
,
"private"
:
true
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment