2014-03-04 60 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中編寫你的配置文件:)

相關問題