mobiletto 1.1.8 → 1.1.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (117) hide show
  1. package/README.md +56 -4
  2. package/docs/README.md +113 -0
  3. package/docs/af/README.md +455 -0
  4. package/docs/am/README.md +455 -0
  5. package/docs/ar/README.md +455 -0
  6. package/docs/az/README.md +455 -0
  7. package/docs/be/README.md +455 -0
  8. package/docs/bg/README.md +455 -0
  9. package/docs/bn/README.md +455 -0
  10. package/docs/bs/README.md +455 -0
  11. package/docs/ca/README.md +455 -0
  12. package/docs/ceb/README.md +455 -0
  13. package/docs/co/README.md +455 -0
  14. package/docs/cs/README.md +455 -0
  15. package/docs/cy/README.md +455 -0
  16. package/docs/da/README.md +455 -0
  17. package/docs/de/README.md +455 -0
  18. package/docs/el/README.md +455 -0
  19. package/docs/eo/README.md +455 -0
  20. package/docs/es/README.md +455 -0
  21. package/docs/et/README.md +455 -0
  22. package/docs/eu/README.md +455 -0
  23. package/docs/fa/README.md +455 -0
  24. package/docs/fi/README.md +455 -0
  25. package/docs/fr/README.md +455 -0
  26. package/docs/fy/README.md +455 -0
  27. package/docs/ga/README.md +455 -0
  28. package/docs/gd/README.md +455 -0
  29. package/docs/gl/README.md +455 -0
  30. package/docs/gu/README.md +455 -0
  31. package/docs/ha/README.md +455 -0
  32. package/docs/haw/README.md +455 -0
  33. package/docs/he/README.md +455 -0
  34. package/docs/hi/README.md +455 -0
  35. package/docs/hmn/README.md +455 -0
  36. package/docs/hr/README.md +455 -0
  37. package/docs/ht/README.md +455 -0
  38. package/docs/hu/README.md +455 -0
  39. package/docs/hy/README.md +455 -0
  40. package/docs/id/README.md +455 -0
  41. package/docs/ig/README.md +455 -0
  42. package/docs/is/README.md +455 -0
  43. package/docs/it/README.md +455 -0
  44. package/docs/iw/README.md +455 -0
  45. package/docs/ja/README.md +455 -0
  46. package/docs/jv/README.md +455 -0
  47. package/docs/ka/README.md +455 -0
  48. package/docs/kk/README.md +455 -0
  49. package/docs/km/README.md +455 -0
  50. package/docs/kn/README.md +455 -0
  51. package/docs/ko/README.md +455 -0
  52. package/docs/ku/README.md +455 -0
  53. package/docs/ky/README.md +455 -0
  54. package/docs/la/README.md +455 -0
  55. package/docs/lb/README.md +455 -0
  56. package/docs/lo/README.md +455 -0
  57. package/docs/lt/README.md +455 -0
  58. package/docs/lv/README.md +455 -0
  59. package/docs/mg/README.md +455 -0
  60. package/docs/mi/README.md +455 -0
  61. package/docs/mk/README.md +455 -0
  62. package/docs/ml/README.md +455 -0
  63. package/docs/mn/README.md +455 -0
  64. package/docs/mr/README.md +455 -0
  65. package/docs/ms/README.md +455 -0
  66. package/docs/mt/README.md +455 -0
  67. package/docs/my/README.md +455 -0
  68. package/docs/ne/README.md +455 -0
  69. package/docs/nl/README.md +455 -0
  70. package/docs/no/README.md +455 -0
  71. package/docs/ny/README.md +455 -0
  72. package/docs/or/README.md +455 -0
  73. package/docs/pa/README.md +455 -0
  74. package/docs/pl/README.md +455 -0
  75. package/docs/ps/README.md +455 -0
  76. package/docs/pt/README.md +455 -0
  77. package/docs/ro/README.md +455 -0
  78. package/docs/ru/README.md +455 -0
  79. package/docs/rw/README.md +455 -0
  80. package/docs/sd/README.md +455 -0
  81. package/docs/si/README.md +455 -0
  82. package/docs/sk/README.md +455 -0
  83. package/docs/sl/README.md +455 -0
  84. package/docs/sm/README.md +455 -0
  85. package/docs/sn/README.md +455 -0
  86. package/docs/so/README.md +455 -0
  87. package/docs/sq/README.md +455 -0
  88. package/docs/sr/README.md +455 -0
  89. package/docs/st/README.md +455 -0
  90. package/docs/su/README.md +455 -0
  91. package/docs/sv/README.md +455 -0
  92. package/docs/sw/README.md +455 -0
  93. package/docs/ta/README.md +455 -0
  94. package/docs/te/README.md +455 -0
  95. package/docs/tg/README.md +455 -0
  96. package/docs/th/README.md +455 -0
  97. package/docs/tk/README.md +455 -0
  98. package/docs/tl/README.md +455 -0
  99. package/docs/tr/README.md +455 -0
  100. package/docs/tt/README.md +455 -0
  101. package/docs/ug/README.md +455 -0
  102. package/docs/uk/README.md +455 -0
  103. package/docs/ur/README.md +455 -0
  104. package/docs/uz/README.md +455 -0
  105. package/docs/vi/README.md +455 -0
  106. package/docs/xh/README.md +455 -0
  107. package/docs/yi/README.md +455 -0
  108. package/docs/yo/README.md +455 -0
  109. package/docs/zh/README.md +455 -0
  110. package/docs/zu/README.md +455 -0
  111. package/drivers/b2/index.js +24 -6
  112. package/hokey.json +16 -0
  113. package/index.js +33 -17
  114. package/package.json +3 -2
  115. package/test/api.spec.js +319 -306
  116. package/util/logger.js +1 -1
  117. package/util/redis.js +1 -1
@@ -0,0 +1,455 @@
1
+ 모빌레토
2
+ ==========
3
+
4
+ Mobiletto는 선택적 투명 클라이언트 측 암호화가 있는 JavaScript 스토리지 추상화 계층입니다.
5
+
6
+ # 내용물
7
+ * [왜 모빌레또인가?](#왜 모빌레또인가?)
8
+ * [빠른 시작](#빠른 시작)
9
+ * [모빌레토 CLI](#mobiletto-cli)
10
+ * [출처](#출처)
11
+ * [기본사용법](#기본사용법)
12
+ * [메타데이터](#메타데이터)
13
+ * [대체 가져오기 스타일](#대체 가져오기 스타일)
14
+ * [캐싱](#캐싱)
15
+ * [미러링](#미러링)
16
+ * [투명암호화](#투명암호화)
17
+ * [키 회전](#키 회전)
18
+ * [드라이버 인터페이스](#드라이버 인터페이스)
19
+ * [로깅](#로깅)
20
+
21
+ # 다른 언어로 읽어보세요
22
+ 이 README.md 문서는 [hokeylization](https://github.com/cobbzilla/hokeylization)을 통해 다음으로 번역되었습니다.
23
+ **[Google 번역에서 지원하는 모든 언어](https://cloud.google.com/translate/docs/languages)!**
24
+
25
+ 나는 그것이 완벽하지 않다고 확신하지만, 없는 것보다 나을 수 있기를 바랍니다!
26
+
27
+ [🇸🇦 아랍어](../ar/README.md)
28
+ [🇧🇩 벵골어](../bn/README.md)
29
+ [🇩🇪 독일어](../de/README.md)
30
+ [🇺🇸 영어](../en/README.md)
31
+ [🇪🇸 스페인어](../es/README.md)
32
+ [🇫🇷 프랑스어](../fr/README.md)
33
+ [🇹🇩 Hausa](../ha/README.md)
34
+ [🇮🇳 힌디어](../hi/README.md)
35
+ [🇮🇩 인도네시아어](../id/README.md)
36
+ [🇮🇹 이탈리아어](../it/README.md)
37
+ [🇯🇵 일본어](../ja/README.md)
38
+ [🇰🇷 한국어](../ko/README.md)
39
+ [🇮🇳 마란티](../mr/README.md)
40
+ [🇵🇱 폴란드어](../pl/README.md)
41
+ [🇧🇷 포르투갈어](../pt/README.md)
42
+ [🇷🇺 러시아어](../ru/README.md)
43
+ [🇰🇪 스와힐리어](../sw/README.md)
44
+ [🇵🇭 타갈로그어](../tl/README.md)
45
+ [🇹🇷 터키어](../tr/README.md)
46
+ [🇵🇰 우르두어](../ur/README.md)
47
+ [🇻🇳 베트남어](../vi/README.md)
48
+ [🇨🇳 중국어](../zh/README.md)
49
+
50
+
51
+ **[📚 ... 모든 언어 ...](../README.md)**
52
+ ----
53
+
54
+ ### 이 README 번역에 문제가 있습니까?
55
+ 원본 [README](https://github.com/cobbzilla/mobiletto/blob/master/README.md)의 이 특정 번역
56
+ 결함이 있을 수 있음 -- *수정은 매우 환영합니다!* [GitHub에서 pull 요청](https://github.com/cobbzilla/mobiletto/pulls)을 보내주세요.
57
+ 또는 그렇게 하는 것이 편하지 않다면 [문제 열기](https://github.com/cobbzilla/mobiletto/issues)
58
+
59
+ 번역에 대한 새 GitHub 문제를 만들 때 다음을 수행하십시오.
60
+ * 페이지 URL 포함(브라우저 주소 표시줄에서 복사/붙여넣기)
61
+ * 잘못된 정확한 텍스트 포함(브라우저에서 복사/붙여넣기)
62
+ * 무엇이 잘못되었는지 설명해주세요 -- 번역이 잘못되었습니까? 형식이 어떻게 든 손상 되었습니까?
63
+ * 더 나은 번역을 제안하거나 텍스트 형식을 올바르게 지정하는 방법을 알려주세요.
64
+ * **고맙습니다!**
65
+
66
+ ## 왜 모빌레토인가?
67
+
68
+ ### 공급업체 종속은 이제 안녕!
69
+ 다양한 클라우드 스토리지 제공업체에는 호환되지 않는 API가 있습니다. "S3 호환성"을 추구하는 분들도
70
+ 특이한 행동을 한다.
71
+
72
+ 앱에 대한 특정 저장소 공급업체를 선택할 때 해당 API에 직접 코딩하면 앱이
73
+ 이제 해당 서비스에 종속됩니다. 시간이 흐르고 코드가 누적됨에 따라 벤더 변경은
74
+ 점점 버틸 수 없는. 벤더 종속의 재미있는 세계에 오신 것을 환영합니다!
75
+
76
+ Mobiletto는 이 문제를 해결하기 위해 설계되었습니다. 모바일토토의 API에 앱을 코딩하면 쉽게
77
+ 저장소 공급자를 변경하고 앱의 저장소 계층이 동일하게 작동한다는 것을 알고 있습니다.
78
+
79
+ ### 광범위한 테스트
80
+ 모든 드라이버는 각 드라이버에 대해 60개 이상의 테스트를 통해 동일한 동작을 테스트합니다.
81
+ 다음의 모든 조합으로 모든 드라이버를 테스트합니다.
82
+ * 암호화: 활성화 및 비활성화
83
+ * Redis 캐시: 활성화 및 비활성화
84
+
85
+ 이 접근 방식은 사용하는 드라이버에 관계없이 mobiletto가 동일하게 작동한다는 마음의 평화를 제공합니다.
86
+ 캐싱 및/또는 암호화를 활성화하는지 여부에 관계없이.
87
+
88
+ ### 드라이버 지원
89
+ 현재 Mobiletto 스토리지 드라이버:
90
+ * `s3` : 아마존 S3
91
+ * `b2` : 백블레이즈 B2
92
+ * `local` : 로컬 파일 시스템
93
+
94
+ *더 많은 클라우드 스토리지 제공업체를 지원하기 위한 기여를 환영합니다!*
95
+
96
+ ## 모바일토클리
97
+ Mobiletto는 다른 JavaScript 코드에서 라이브러리로 사용하기 위한 것입니다.
98
+
99
+ 명령줄에서 mobiletto를 사용하려면 [mobiletto-cli](https://www.npmjs.com/package/mobiletto-cli)를 사용하세요.
100
+
101
+ ## 원천
102
+ * [GitHub의 모빌레토](https://github.com/cobbzilla/mobiletto)
103
+ * [npm의 모빌레토](https://www.npmjs.com/package/mobiletto)
104
+
105
+ ## 빠른 시작
106
+ mobiletto `s3` 드라이버를 사용한 간단한 예입니다.
107
+
108
+ 이 코드는 드라이버가 `b2` 또는 `local` 이면 동일하게 실행됩니다.
109
+
110
+ const storage = require('mobiletto')
111
+ const bucket = await storage.connect('s3', aws_key, aws_secret, {bucket: 'bk'})
112
+
113
+ // list objects: returns array of metadata objects
114
+ const listing = await bucket.list()
115
+ const dirList = await bucket.list('some/dir/')
116
+ const everything = await bucket.list('', {recursive: true})
117
+
118
+ // write an entire file
119
+ let bytesWritten = await bucket.writeFile('some/path', someBufferOfData)
120
+
121
+ // write a file from a stream/generator
122
+ bytesWritten = await bucket.write('some/path', streamOrGenerator)
123
+
124
+ // read an entire file
125
+ // returns null if an exception would otherwise be thrown
126
+ const bufferOrNull = await bucket.safeReadFile('some/path')
127
+
128
+ // stream-read a file, passing data to callback
129
+ const bytesRead = await bucket.read('some/path', (chunk) => { ...do something with chunk... } )
130
+
131
+ // remove a file, returns the path removed
132
+ let removed = await bucket.remove('some/path') // removed is a string
133
+
134
+ // remove a directory, returns array of paths removed
135
+ removed = await bucket.remove('some/directory', {recursive: true}) // removed is now an array!
136
+
137
+ ----
138
+ ## 기본 사용법
139
+ 제공되는 대부분의 기능을 보여주는 훨씬 더 광범위한 예:
140
+
141
+ const { mobiletto } = require('mobiletto')
142
+
143
+ // General usage
144
+ const api = await mobiletto(driverName, key, secret, opts)
145
+
146
+ // To use 'local' driver:
147
+ // * key: base directory
148
+ // * secret: ignored, can be null
149
+ // * opts object:
150
+ // * readOnly: optional, never change anything on the filesystem; default is false
151
+ // * fileMode: optional, permissions used when creating new files, default is 0600. can be string or integer
152
+ // * dirMode: optional, permissions used when creating new directories, default is 0700. can be string or integer
153
+ const local = await mobiletto('local', '/home/ubuntu/tmp', null, {fileMode: 0o0600, dirMode: '0700'})
154
+
155
+ // To use 's3' driver:
156
+ // * key: AWS Access Key ID
157
+ // * secret: AWS Secret Key
158
+ // * opts object:
159
+ // * readOnly: optional, never change anything on the bucket; default is false
160
+ // * bucket: required, name of the S3 bucket
161
+ // * region: optional, the AWS region to communicate with, default is us-east-1
162
+ // * prefix: optional, all read/writes within the S3 bucket will be under this prefix
163
+ // * delimiter: optional, directory delimiter, default is '/' (note: always '/' when encryption is enabled)
164
+ const s3 = await mobiletto('s3', aws_key, aws_secret, {bucket: 'bk', region: 'us-east-1'})
165
+
166
+ // To use 'b2' driver:
167
+ // * key: Backblaze Key ID
168
+ // * secret: Backblaze Application Key
169
+ // * opts object:
170
+ // * readOnly: optional, never change anything on the bucket; default is false
171
+ // * bucket: required, the ID (**not the name**) of the B2 bucket
172
+ // * prefix: optional, all read/writes within the B2 bucket will be under this prefix
173
+ // * delimiter: optional, directory delimiter, default is '/' (note: always '/' when encryption is enabled)
174
+ // * partSize: optional, large files will be split into chunks of this size when uploading
175
+ const b3 = await mobiletto('b2', b2_key_id, b2_app_key, {bucket: 'bk', partSize: 10000000})
176
+
177
+ // List files
178
+ api.list() // --> returns an array of metadata objects
179
+
180
+ // List files recursively
181
+ api.list({ recursive: true })
182
+
183
+ // List files in a directory
184
+ const path = 'some/path'
185
+ api.list(path)
186
+ api.list(path, { recursive: true }) // also supports recursive flag
187
+
188
+ // Visit files in a directory -- visitor function must be async
189
+ api.list(path, { visitor: myAsyncFunc })
190
+ api.list(path, { visitor: myAsyncFunc, recursive: true })
191
+
192
+ // The `list` method throws MobilettoNotFoundError if the path does not exist
193
+ // When you call `safeList` on a non-existent path, it returns an empty array
194
+ api.safeList('/path/that/does/not/exist') // returns []
195
+
196
+ // Read metadata for a file
197
+ api.metadata(path) // returns metadata object
198
+
199
+ // The `metadata` method throws MobilettoNotFoundError if the path does not exist
200
+ // When you call `safeMetadata` on a non-existent path, it returns null
201
+ api.safeMetadata('/tmp/does_not_exist') // returns null
202
+
203
+ // Read a file
204
+ // Provide a callback that writes the data someplace
205
+ const callback = (chunk) => { ... write chunk somewhere ... }
206
+ api.read(path, callback) // returns count of bytes read
207
+
208
+ // Read an entire file at once
209
+ const data = await api.readFile(path) // returns a byte Buffer of the file contents
210
+
211
+ // Read an entire file at once
212
+ // returns null if an exception would otherwise be thrown
213
+ const bufferOrNull = await bucket.safeReadFile('some/path')
214
+
215
+ // Write a file
216
+ // Provide a generator function that yields chunks of data
217
+ const generator = function* () {
218
+ while ( ... more-data-to-return ... ) {
219
+ data = ... load-data ...
220
+ yield data
221
+ }
222
+ }
223
+ local.api(path, generator) // returns count of bytes written
224
+
225
+ // Write an entire file at once (convenience method)
226
+ await api.writeFile(path, bufferOrString) // returns count of bytes written
227
+
228
+ // Delete a file
229
+ // Quiet param is optional (default false), when set errors will not be thrown if the path does not exist
230
+ // Always returns a value or throws an error.
231
+ // Return value may be a single string of the file removed, or an array of all files removed (driver-dependent)
232
+ const quiet = true
233
+ api.remove(path, {quiet}) // returns single path removed
234
+
235
+ // Recursively delete a directory and do it quietly (do not report errors)
236
+ const recursive = true
237
+ const quiet = true
238
+ api.remove(path, {recursive, quiet}) // returns array of paths removed
239
+
240
+ ## 메타데이터
241
+ `metadata` 명령은 단일 파일 시스템 항목에 대한 메타데이터를 반환합니다.
242
+ 마찬가지로 `list` 명령의 반환 값은 메타데이터 개체의 배열입니다.
243
+
244
+ 메타데이터 개체는 다음과 같습니다.
245
+
246
+ {
247
+ "name": "fully/qualified/path/to/file",
248
+ "type": "entry-type",
249
+ "size": size-in-bytes,
250
+ "ctime": creation-time-epoch-millis,
251
+ "mtime": modification-time-epoch-millis
252
+ }
253
+
254
+ `type` type` 속성은 `file` , `dir` , `link` 또는 `special` 일 수 있습니다.
255
+
256
+ 드라이버 유형에 따라 `list` 명령이 모든 필드를 반환하지 않을 수 있습니다. `name` 및 `type` 유형' 속성
257
+ 항상 존재해야 합니다. 후속 `metadata` 명령은 사용 가능한 모든 속성을 반환합니다.
258
+
259
+ ## 대체 가져오기 스타일
260
+ 전체 범위 모듈을 가져 `connect` 기능을 사용합니다.
261
+
262
+ const storage = require('mobiletto')
263
+ const opts = {bucket: 'bk', region: 'us-east-1'}
264
+ const s3 = await storage.connect('s3', aws_key, aws_secret, opts)
265
+ const objectData = await s3.readFile('some/path')
266
+
267
+ ## 캐싱
268
+ Mobiletto는 <a href="https://redis.io">redis</a> 캐시에서 가장 잘 작동합니다.
269
+
270
+ Mobiletto는 127.0.0.1:6379에서 redis 인스턴스에 연결을 시도합니다.
271
+
272
+ 다음 중 하나를 재정의할 수 있습니다.
273
+ * `MOBILETTO_REDIS_HOST` env var, mobilet 설정하여 localhost 대신 여기에 연결
274
+ * `MOBILETTO_REDIS_PORT` 환경 변수를 설정합니다. 이 포트가 사용됩니다.
275
+
276
+ Mobiletto는 모든 redis 키를 접두사 `_mobiletto__` 로 저장합니다. 당신은 이것을 변경할 수 있습니다
277
+ `MOBILETTO_REDIS_PREFIX` 환경 변수를 설정하여
278
+
279
+ `opts.redisConfig` 객체를 사용하여 연결별 캐싱을 설정할 수도 있습니다.
280
+
281
+ const redisConfig = {
282
+ enabled: true, // optional, default is true. if false other props are ignored
283
+ host: '127.0.0.1',
284
+ port: 6379,
285
+ prefix: '_mobiletto__'
286
+ }
287
+ const opts = { redisConfig, bucket: 'bk', region: 'us-east-1' }
288
+ const s3 = await storage.connect('s3', aws_key, aws_secret, opts)
289
+
290
+ ### redis 캐싱을 원하지 않습니까?
291
+ 비활성화하려면: 연결을 설정할 때 `opts.redisConfig` 개체에 `enabled: false` false`를 전달합니다.
292
+
293
+ 아래에서 설명하는 것처럼 캐싱을 비활성화하면 성능에 부정적인 영향을 미치고 더 많은 요청이 발생합니다.
294
+ 정말 필요한 스토리지에.
295
+
296
+ ### 캐싱 안내
297
+ **암호화된 저장소**: 암호화된 저장소 읽기/쓰기가 평소보다 약간 느립니다.
298
+ 그러나 디렉토리를 탐색하는 것(일부 작업이 수행함)은 상당히 비쌉니다. 레디스 캐시 사용
299
+ 상당한 성능 향상을 제공합니다.
300
+
301
+ 기본 캐시는 안전하지만 쓰기/제거 작업이 많은 경우에는 제대로 작동하지 않습니다.
302
+ 모든 쓰기 또는 제거 작업은 전체 캐시를 무효화하여 후속 읽기에서
303
+ 최신 변경 사항.
304
+
305
+ ### CLI 도구
306
+ [mobiletto-cli](https://www.npmjs.com/package/mobiletto-cli)와 같은 CLI 도구를 사용하는 경우,
307
+ `mo` 명령을 호출하는 동안 지속되므로 redis 캐시를 활성화해야 합니다.
308
+
309
+ ## 미러링
310
+
311
+ // Copy a local filesystem mobiletto to S3
312
+ s3.mirror(local)
313
+
314
+ // Mirror a local subdirectory from one mobiletto to an S3 mobiletto, with it's own subdirectory
315
+ local.mirror(s3, 'some/local-folder', 'some/s3-folder')
316
+
317
+ `mirror` 명령은 한 mobiletto에서 다른 mobiletto로 모든 파일의 일회성 복사를 수행합니다.
318
+ 시간이 지남에 따라 미러를 유지 관리하는 프로세스를 실행하지 않습니다. `mirror` 명령을 다시 실행하십시오.
319
+ 누락된 파일을 동기화합니다.
320
+
321
+ `mirror` 의 반환 값은 성공적으로 성공한 파일 수에 대한 카운터가 있는 간단한 개체입니다.
322
+ 미러링된 파일 수 및 오류가 발생한 파일 수:
323
+
324
+ {
325
+ success: count-of-files-mirrored,
326
+ errors: count-of-files-with-errors
327
+ }
328
+
329
+ 경고: 대규모 데이터 세트 미러링은 시간과 대역폭을 많이 소모할 수 있습니다.
330
+
331
+ `mirror` 호출 의미 체계를 사용하면 누가 누구인지 이해하는 것이 때때로 혼란스러울 수 있습니다.
332
+ 독자와 작가는 누구인가. "left-hand mobiletto"라는 할당문처럼 상상해보십시오.
333
+ (미러링된 데이터 쓰기)에 할당된 것, 그리고 "오른쪽 모빌레토"(
334
+ `mirror` 메서드에 대한 인수)는 할당되는 값입니다(미러링된 데이터를 읽음).
335
+
336
+ ## 투명한 암호화
337
+ 투명한 클라이언트 측 암호화 활성화:
338
+
339
+ // Pass encryption parameters
340
+ const encryption = {
341
+ // key is required, must be >= 16 chars
342
+ key: randomstring.generate(128),
343
+
344
+ // optional, the default is to derive IV from key
345
+ // when set, IV must be >= 16 chars
346
+ iv: randomstring.generate(128),
347
+
348
+ // optional, the default is aes-256-cbc
349
+ algo: 'aes-256-cbc'
350
+ }
351
+ const api = await mobiletto(driverName, key, secret, opts, encryption)
352
+
353
+ // Subsequent write operations will encrypt data (client side) when writing
354
+ // Subsequent read operations will decrypt data (client side) when reading
355
+
356
+ 무슨 일이야? 별도의 "디렉토리 항목"(디렉트) 디렉토리(암호화됨)는 해당 디렉토리에 있는 파일을 추적합니다.
357
+ 디렉토리(일명 디렉토리 디렉토리).
358
+ * `list` 명령은 디렉토리 항목 파일을 읽고 나열된 각 경로를 해독합니다. 그런 다음 각 파일에 대한 메타데이터를 반환합니다.
359
+ * `list` 명령은 특히 파일 수가 많은 디렉토리의 경우 더 비효율적입니다.
360
+ * `write` 명령은 각 부모의 dirent 디렉토리에 dirent 파일을 재귀적으로 씁니다. 그런 다음 파일을 씁니다.
361
+ * `write` 명령은 O(N) 쓰기를 발생시키며 N = 디렉토리 계층 구조의 깊이
362
+ * `remove` 명령은 상응하는 dirent 파일을 제거하고, 비어 있으면 그 상위 파일을 재귀적으로 제거합니다. 그런 다음 파일을 제거합니다.
363
+ * 비재귀적 `remove` 명령은 O(N) 읽기 및 잠재적으로 많은 삭제를 발생시킵니다. N = 디렉토리 계층 구조의 깊이
364
+ * 크고 깊은 파일 시스템에서 재귀 `remove` 명령은 비용이 많이 들 수 있습니다.
365
+
366
+ 클라이언트 측 암호화가 활성화된 경우에도 공격자는 암호화된 서버 측을 완전히 볼 수 있습니다.
367
+ 스토리지는 키가 없어도 여전히 총 디렉토리 수와 각 디렉토리에 있는 파일 수를 볼 수 있습니다.
368
+ 약간의 노력을 기울이면 디렉토리 계층 구조의 전체 또는 일부를 발견할 수 있습니다.
369
+ *참고: 더 나은 보안을 위해 비교적 평평한 구조를 사용하십시오.*
370
+ 공격자는 귀하의 암호화를 알고 있지 않는 한 디렉토리/파일의 이름을 모릅니다.
371
+ 키 또는 그렇지 않으면 암호화를 성공적으로 해독했습니다. 그러면 모든 베팅이 종료됩니다!
372
+
373
+ ### 성능 및 캐싱
374
+ 암호화된 저장소에 대한 작업은 느릴 수 있습니다. 재귀 목록 및 제거는 매우 느릴 수 있습니다.
375
+ redis를 통한 캐싱은 매우 도움이 되지만 캐시는 쓰기 또는 제거 시 플러시됩니다.
376
+
377
+ ## 키 회전
378
+ 새 키로 mobiletto를 만든 다음 이전 데이터를 여기에 미러링합니다.
379
+
380
+ const storage = require('mobiletto')
381
+
382
+ const oldEncryption = { key: .... }
383
+ const oldStorage = await storage.connect('s3', aws_key, aws_secret, {bucket: 'bk', region: 'us-east-1'}, oldEncryption)
384
+
385
+ const newEncryption = { key: .... }
386
+ const newStorage = await storage.connect('s3', aws_key, aws_secret, {bucket: 'zz', region: 'us-east-1'}, newEncryption)
387
+
388
+ newStorage.mirror(oldStorage) // if oldStorage is very large, this may take a looooooong time...
389
+
390
+ ## 드라이버 인터페이스
391
+ 드라이버는 다음 서명이 있는 'storageClient' 함수를 내보내는 모든 JS 파일입니다.
392
+
393
+ function storageClient (key, secret, opts)
394
+
395
+ * `key` : 문자열, API 키( `local` 드라이버의 경우 기본 디렉토리임)
396
+ * `secret` : 문자열, API 비밀( `local` 드라이버의 경우 생략 가능)
397
+ * `opts` : 객체, 속성은 드라이버별:
398
+ * `local` 의 경우 `fileMode` 및 `dirMode` 속성에 따라 새로 생성되는 파일과 디렉토리가 생성되는 방식이 결정됩니다.
399
+ * `s3` 의 경우 `bucket` 속성이 필요합니다. 선택적 속성은 다음과 같습니다.
400
+ * `region`: the S3 region, default is us-east-1
401
+ * `prefix`: a prefix to prepend to all S3 paths, default is the empty string
402
+ * `delimiter`: the directory delimiter, default is '/'
403
+
404
+ storageClient 함수가 반환하는 객체는 다음 함수를 정의해야 합니다.
405
+
406
+ // Test the driver before using, ensure proper configuration
407
+ async testConfig ()
408
+
409
+ // List files in path (or from base-directory)
410
+ // If recursive is true, list recursively
411
+ // If visitor is defined, it will be an async function. await the visitor function on each file found
412
+ // Otherwise, perform the listing and return an array of objects
413
+ async list (path, recursive = false, visitor = null) // path may be omitted
414
+
415
+ // Read metadata for a path
416
+ async metadata (path)
417
+
418
+ // Read a file
419
+ // callback receives a chunk of data. endCallback is called at end-of-stream
420
+ async read (path, callback, endCallback = null)
421
+
422
+ // Write a file
423
+ // driver must be able to handle a generator or a stream
424
+ async write (path, generatorOrReadableStream)
425
+
426
+ // Remove a file, or recursively delete a directory
427
+ // returns a string of a single path removed, or an array of multiple paths removed
428
+ async remove (path, recursive = false, quiet = false)
429
+
430
+ ## 로깅
431
+ Mobiletto는 [winston](https://www.npmjs.com/package/winston) 로깅 라이브러리를 사용합니다.
432
+
433
+ 로그에는 파일 경로와 오류 메시지가 **포함되지만**에는 키, 비밀,
434
+ 또는 기타 연결 구성 정보.
435
+
436
+ ### 로그 수준
437
+ `MOBILETTO_LOG_LEVEL` 환경 변수를 사용하여 로그 수준을 설정합니다.
438
+ [https://www.npmjs.com/package/winston#logging-levels](https://www.npmjs.com/package/winston#logging-levels)에 정의된 `npm` 레벨
439
+
440
+ 기본 수준은 `error` 입니다. 가장 장황한 수준은 `silly` 이지만 현재는 모바일로
441
+ `debug` 보다 낮은 수준에서는 기록하지 않습니다.
442
+
443
+ MOBILETTO_LOG_LEVEL=silly # maximum logs!
444
+
445
+ ### 로그 파일
446
+ 기본적으로 로거는 콘솔에 기록합니다. 로그를 파일로 보내려면 `MOBILETTO_LOG_FILE` 을 설정하세요.
447
+ 환경 변수. 파일에 로깅할 때 로그는 더 이상 콘솔에 기록되지 않습니다.
448
+
449
+ MOBILETTO_LOG_FILE=/var/my_mobiletto_log
450
+
451
+ 로깅을 끄려면:
452
+
453
+ MOBILETTO_LOG_FILE=/dev/null
454
+
455
+ </pre>