2014-03-04 64 views
0

我有一个目录结构如下:如何在node.js中读取存储器内文件目录和存储

Folder Structure 
     Config—folder 

       10001—folder 
         20001—folder 
          20001.properties 
        10001.properties       

       App.json 
       Config.properties 

这里配置,10001,20001是文件夹。 我希望有一个逻辑来实现,如果我给配置为根文件夹,然后我的代码应该扫描并生成输出如下:

Config.Config.properties : { 
here it should have the config.propertis values 
} 

Config.App.json : { 
    here it should have the config.propertis values 
} 

Config.10001.10001.properties : { 
here it should have the 10001.propertis values 
} 

Config.10001.20001.20001.properties : { 
here it should have the 20001.propertis values 
} 

回答

0

使用this包,它会看起来像:

require('require_tree').require_tree('./Config', {preserve_filenames: true}) 

PS:请不要在json中编写你的配置文件:)

相关问题