File tree 2 files changed +32
-0
lines changed
2 files changed +32
-0
lines changed Original file line number Diff line number Diff line change
1
+ var _getAllFilesFromFolder = function ( dir ) {
2
+ var filesystem = require ( "fs" ) ;
3
+ var results = [ ] ;
4
+
5
+ filesystem . readdirSync ( dir ) . forEach ( function ( file ) {
6
+ file = dir + "/" + file ;
7
+ var stat = filesystem . statSync ( file ) ;
8
+
9
+ if ( stat && stat . isDirectory ( ) ) {
10
+ results = results . concat ( _getAllFilesFromFolder ( file ) ) ;
11
+ } else results . push ( file ) ;
12
+ } ) ;
13
+
14
+ return results ;
15
+ } ;
16
+
17
+ module . exports . handler = async ( event ) => {
18
+ const dir = event . dir || "/" ;
19
+ return {
20
+ statusCode : 200 ,
21
+ body : JSON . stringify (
22
+ {
23
+ message : JSON . stringify ( _getAllFilesFromFolder ( dir ) ) ,
24
+ input : event ,
25
+ } ,
26
+ null ,
27
+ 2
28
+ ) ,
29
+ } ;
30
+ } ;
Original file line number Diff line number Diff line change @@ -35,6 +35,8 @@ provider:
35
35
STAGE : ${self:provider.stage}
36
36
37
37
functions :
38
+ inspect :
39
+ handler : index.handler
38
40
github :
39
41
handler : src/lambda.handler
40
42
timeout : 29
You can’t perform that action at this time.
0 commit comments