1.0.1 • Published 2 years ago

zc-file-storage-service v1.0.1

Weekly downloads
-
License
ISC
Repository
-
Last release
2 years ago

zc-file-storage-service

intruoduce

  1. zhice teamson company development this module and all right reserved!
  2. attention ! just suport the spring-ioc framework.

install

npm instlal zc-file-storage-service

usage

1.set the configuration file
file path: ${Project}/resource/ZcFileStorageService.json
basic config:
{
	"fileList":[
		{
			"name":"app",
			"initData":[],
			"filePath":"${ROOT_PATH}/app.log"
		}
	]
}

2. load email module at launch.

const {SpringBoot} = require("spring-ioc")
const {ZcFileStorageServiceScaner} = require("zc-file-storage-service")

new SpringBoot({
	srcList:["./app"],
	moduleList:[ZcFileStorageServiceScaner]
}).run();

3. call in the spring container!

//@SpringBoot
class Application {

	//@Autowired
	zcFileStorageService;

	appLog;

	async beanInit(){
		/**
			1.json name convert to fileWrap Object and map to zcFileStorageService.files.
			2.${ROOT_PATH} is root path of project.
			3.allow set mutilple file configuration.
			{
				"fileList":[
					{
						"name":"app",
						"initData":[],
						"filePath":"${ROOT_PATH}/app.log"
					}
				]
			}
		*/
		this.appLog = this.zcFileStorageService.files.app;
	}

	async main(){

		this.appLog.update(data => data.push("222"))

	}

}