@loaders.gl/loader-utils 4.0.0-beta.1 → 4.0.0-beta.3

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 (313) hide show
  1. package/dist/index.cjs +1252 -0
  2. package/dist/index.d.ts +7 -10
  3. package/dist/index.d.ts.map +1 -1
  4. package/dist/index.js +34 -0
  5. package/dist/index.js.map +1 -0
  6. package/dist/{esm/json-loader.js → json-loader.js} +1 -1
  7. package/dist/json-loader.js.map +1 -0
  8. package/dist/lib/binary-utils/array-buffer-utils.js.map +1 -0
  9. package/dist/{esm/lib → lib}/binary-utils/dataview-copy-utils.js +1 -1
  10. package/dist/lib/binary-utils/dataview-copy-utils.js.map +1 -0
  11. package/dist/lib/binary-utils/get-first-characters.js.map +1 -0
  12. package/dist/{esm/lib → lib}/binary-utils/memory-conversion-utils.js +1 -1
  13. package/dist/lib/binary-utils/memory-conversion-utils.js.map +1 -0
  14. package/dist/{esm/lib → lib}/binary-utils/memory-copy-utils.js +1 -1
  15. package/dist/lib/binary-utils/memory-copy-utils.js.map +1 -0
  16. package/dist/lib/env-utils/assert.js.map +1 -0
  17. package/dist/lib/env-utils/globals.js.map +1 -0
  18. package/dist/lib/file-provider/data-view-file.d.ts +4 -1
  19. package/dist/lib/file-provider/data-view-file.d.ts.map +1 -1
  20. package/dist/{esm/lib → lib}/file-provider/data-view-file.js +1 -2
  21. package/dist/lib/file-provider/data-view-file.js.map +1 -0
  22. package/dist/lib/file-provider/file-handle-file.d.ts +12 -19
  23. package/dist/lib/file-provider/file-handle-file.d.ts.map +1 -1
  24. package/dist/lib/file-provider/file-handle-file.js +56 -0
  25. package/dist/lib/file-provider/file-handle-file.js.map +1 -0
  26. package/dist/lib/file-provider/file-provider.d.ts +1 -0
  27. package/dist/lib/file-provider/file-provider.d.ts.map +1 -1
  28. package/dist/lib/file-provider/file-provider.js.map +1 -0
  29. package/dist/lib/files/blob-file.d.ts +16 -0
  30. package/dist/lib/files/blob-file.d.ts.map +1 -0
  31. package/dist/lib/files/blob-file.js +25 -0
  32. package/dist/lib/files/blob-file.js.map +1 -0
  33. package/dist/lib/files/file.d.ts +33 -0
  34. package/dist/lib/files/file.d.ts.map +1 -0
  35. package/dist/lib/files/file.js +2 -0
  36. package/dist/lib/files/file.js.map +1 -0
  37. package/dist/lib/files/http-file.d.ts +21 -0
  38. package/dist/lib/files/http-file.d.ts.map +1 -0
  39. package/dist/lib/files/http-file.js +79 -0
  40. package/dist/lib/files/http-file.js.map +1 -0
  41. package/dist/lib/files/node-file-facade.d.ts +18 -0
  42. package/dist/lib/files/node-file-facade.d.ts.map +1 -0
  43. package/dist/lib/files/node-file-facade.js +29 -0
  44. package/dist/lib/files/node-file-facade.js.map +1 -0
  45. package/dist/lib/files/sources.d.ts +1 -0
  46. package/dist/lib/files/sources.d.ts.map +1 -0
  47. package/dist/lib/files/sources.js +2 -0
  48. package/dist/lib/files/sources.js.map +1 -0
  49. package/dist/lib/filesystems/filesystem.d.ts +18 -65
  50. package/dist/lib/filesystems/filesystem.d.ts.map +1 -1
  51. package/dist/lib/filesystems/filesystem.js.map +1 -0
  52. package/dist/lib/filesystems/node-filesystem-facade.d.ts +23 -0
  53. package/dist/lib/filesystems/node-filesystem-facade.d.ts.map +1 -0
  54. package/dist/lib/filesystems/node-filesystem-facade.js +37 -0
  55. package/dist/lib/filesystems/node-filesystem-facade.js.map +1 -0
  56. package/dist/{esm/lib → lib}/iterators/async-iteration.js +1 -1
  57. package/dist/lib/iterators/async-iteration.js.map +1 -0
  58. package/dist/lib/iterators/text-iterators.js.map +1 -0
  59. package/dist/lib/node/buffer.browser.d.ts +1 -1
  60. package/dist/lib/node/buffer.browser.d.ts.map +1 -1
  61. package/dist/lib/node/buffer.browser.js.map +1 -0
  62. package/dist/lib/node/buffer.d.ts +1 -1
  63. package/dist/lib/node/buffer.d.ts.map +1 -1
  64. package/dist/lib/node/buffer.js.map +1 -0
  65. package/dist/lib/node/fs.browser.js.map +1 -0
  66. package/dist/lib/node/promisify.js.map +1 -0
  67. package/dist/lib/node/stream.browser.js.map +1 -0
  68. package/dist/lib/node/stream.js.map +1 -0
  69. package/dist/lib/option-utils/merge-loader-options.js.map +1 -0
  70. package/dist/lib/parser-utils/parse-json.js +9 -0
  71. package/dist/lib/parser-utils/parse-json.js.map +1 -0
  72. package/dist/{esm/lib → lib}/path-utils/file-aliases.js +1 -1
  73. package/dist/lib/path-utils/file-aliases.js.map +1 -0
  74. package/dist/lib/path-utils/get-cwd.js.map +1 -0
  75. package/dist/{esm/lib → lib}/path-utils/path.js +6 -6
  76. package/dist/lib/path-utils/path.js.map +1 -0
  77. package/dist/{esm/lib → lib}/request-utils/request-scheduler.js +6 -7
  78. package/dist/lib/request-utils/request-scheduler.js.map +1 -0
  79. package/dist/{esm/lib → lib}/sources/data-source.js +4 -5
  80. package/dist/lib/sources/data-source.js.map +1 -0
  81. package/dist/lib/sources/image-source.js +5 -0
  82. package/dist/lib/sources/image-source.js.map +1 -0
  83. package/dist/lib/sources/image-tile-source.js.map +1 -0
  84. package/dist/lib/sources/tile-source.js.map +1 -0
  85. package/dist/lib/sources/utils/image-type.js.map +1 -0
  86. package/dist/lib/sources/utils/utils.js.map +1 -0
  87. package/dist/lib/sources/vector-tile-source.js.map +1 -0
  88. package/dist/{esm/lib → lib}/worker-loader-utils/create-loader-worker.js +1 -1
  89. package/dist/lib/worker-loader-utils/create-loader-worker.js.map +1 -0
  90. package/dist/{esm/lib → lib}/worker-loader-utils/encode-with-worker.js +1 -1
  91. package/dist/lib/worker-loader-utils/encode-with-worker.js.map +1 -0
  92. package/dist/{esm/lib → lib}/worker-loader-utils/parse-with-worker.js +1 -1
  93. package/dist/lib/worker-loader-utils/parse-with-worker.js.map +1 -0
  94. package/dist/loader-types.js.map +1 -0
  95. package/dist/service-types.js.map +1 -0
  96. package/dist/types.d.ts +2 -2
  97. package/dist/types.d.ts.map +1 -1
  98. package/dist/types.js.map +1 -0
  99. package/dist/workers/json-worker.js +4 -0
  100. package/dist/workers/json-worker.js.map +1 -0
  101. package/dist/writer-types.js.map +1 -0
  102. package/package.json +13 -5
  103. package/src/index.ts +10 -15
  104. package/src/lib/file-provider/data-view-file.ts +4 -2
  105. package/src/lib/file-provider/file-handle-file.ts +28 -44
  106. package/src/lib/file-provider/file-provider.ts +1 -0
  107. package/src/lib/files/blob-file.ts +32 -0
  108. package/src/lib/files/file.ts +37 -0
  109. package/src/lib/files/http-file.ts +120 -0
  110. package/src/lib/files/node-file-facade.ts +39 -0
  111. package/src/lib/files/sources.ts +150 -0
  112. package/src/lib/filesystems/filesystem.ts +19 -68
  113. package/src/lib/filesystems/node-filesystem-facade.ts +63 -0
  114. package/src/lib/node/buffer.browser.ts +1 -1
  115. package/src/lib/node/buffer.ts +1 -1
  116. package/src/types.ts +0 -4
  117. package/dist/es5/index.js +0 -389
  118. package/dist/es5/index.js.map +0 -1
  119. package/dist/es5/json-loader.js +0 -44
  120. package/dist/es5/json-loader.js.map +0 -1
  121. package/dist/es5/lib/binary-utils/array-buffer-utils.js +0 -80
  122. package/dist/es5/lib/binary-utils/array-buffer-utils.js.map +0 -1
  123. package/dist/es5/lib/binary-utils/dataview-copy-utils.js +0 -58
  124. package/dist/es5/lib/binary-utils/dataview-copy-utils.js.map +0 -1
  125. package/dist/es5/lib/binary-utils/get-first-characters.js +0 -31
  126. package/dist/es5/lib/binary-utils/get-first-characters.js.map +0 -1
  127. package/dist/es5/lib/binary-utils/memory-conversion-utils.js +0 -44
  128. package/dist/es5/lib/binary-utils/memory-conversion-utils.js.map +0 -1
  129. package/dist/es5/lib/binary-utils/memory-copy-utils.js +0 -34
  130. package/dist/es5/lib/binary-utils/memory-copy-utils.js.map +0 -1
  131. package/dist/es5/lib/env-utils/assert.js +0 -12
  132. package/dist/es5/lib/env-utils/assert.js.map +0 -1
  133. package/dist/es5/lib/env-utils/globals.js +0 -30
  134. package/dist/es5/lib/env-utils/globals.js.map +0 -1
  135. package/dist/es5/lib/file-provider/data-view-file.js +0 -146
  136. package/dist/es5/lib/file-provider/data-view-file.js.map +0 -1
  137. package/dist/es5/lib/file-provider/file-handle-file.js +0 -236
  138. package/dist/es5/lib/file-provider/file-handle-file.js.map +0 -1
  139. package/dist/es5/lib/file-provider/file-handle.js +0 -98
  140. package/dist/es5/lib/file-provider/file-handle.js.map +0 -1
  141. package/dist/es5/lib/file-provider/file-provider.js +0 -11
  142. package/dist/es5/lib/file-provider/file-provider.js.map +0 -1
  143. package/dist/es5/lib/filesystems/filesystem.js +0 -2
  144. package/dist/es5/lib/filesystems/filesystem.js.map +0 -1
  145. package/dist/es5/lib/filesystems/node-filesystem.browser.js +0 -172
  146. package/dist/es5/lib/filesystems/node-filesystem.browser.js.map +0 -1
  147. package/dist/es5/lib/filesystems/node-filesystem.js +0 -210
  148. package/dist/es5/lib/filesystems/node-filesystem.js.map +0 -1
  149. package/dist/es5/lib/filesystems/readable-file.js +0 -91
  150. package/dist/es5/lib/filesystems/readable-file.js.map +0 -1
  151. package/dist/es5/lib/filesystems/writable-file.js +0 -82
  152. package/dist/es5/lib/filesystems/writable-file.js.map +0 -1
  153. package/dist/es5/lib/iterators/async-iteration.js +0 -190
  154. package/dist/es5/lib/iterators/async-iteration.js.map +0 -1
  155. package/dist/es5/lib/iterators/text-iterators.js +0 -305
  156. package/dist/es5/lib/iterators/text-iterators.js.map +0 -1
  157. package/dist/es5/lib/node/buffer.browser.js +0 -14
  158. package/dist/es5/lib/node/buffer.browser.js.map +0 -1
  159. package/dist/es5/lib/node/buffer.js +0 -27
  160. package/dist/es5/lib/node/buffer.js.map +0 -1
  161. package/dist/es5/lib/node/fs.browser.js +0 -9
  162. package/dist/es5/lib/node/fs.browser.js.map +0 -1
  163. package/dist/es5/lib/node/fs.js +0 -82
  164. package/dist/es5/lib/node/fs.js.map +0 -1
  165. package/dist/es5/lib/node/promisify.js +0 -36
  166. package/dist/es5/lib/node/promisify.js.map +0 -1
  167. package/dist/es5/lib/node/stream.browser.js +0 -9
  168. package/dist/es5/lib/node/stream.browser.js.map +0 -1
  169. package/dist/es5/lib/node/stream.js +0 -15
  170. package/dist/es5/lib/node/stream.js.map +0 -1
  171. package/dist/es5/lib/option-utils/merge-loader-options.js +0 -30
  172. package/dist/es5/lib/option-utils/merge-loader-options.js.map +0 -1
  173. package/dist/es5/lib/parser-utils/parse-json.js +0 -15
  174. package/dist/es5/lib/parser-utils/parse-json.js.map +0 -1
  175. package/dist/es5/lib/path-utils/file-aliases.js +0 -33
  176. package/dist/es5/lib/path-utils/file-aliases.js.map +0 -1
  177. package/dist/es5/lib/path-utils/get-cwd.js +0 -15
  178. package/dist/es5/lib/path-utils/get-cwd.js.map +0 -1
  179. package/dist/es5/lib/path-utils/path.js +0 -136
  180. package/dist/es5/lib/path-utils/path.js.map +0 -1
  181. package/dist/es5/lib/request-utils/request-scheduler.js +0 -150
  182. package/dist/es5/lib/request-utils/request-scheduler.js.map +0 -1
  183. package/dist/es5/lib/sources/data-source.js +0 -67
  184. package/dist/es5/lib/sources/data-source.js.map +0 -1
  185. package/dist/es5/lib/sources/image-source.js +0 -31
  186. package/dist/es5/lib/sources/image-source.js.map +0 -1
  187. package/dist/es5/lib/sources/image-tile-source.js +0 -2
  188. package/dist/es5/lib/sources/image-tile-source.js.map +0 -1
  189. package/dist/es5/lib/sources/tile-source.js +0 -2
  190. package/dist/es5/lib/sources/tile-source.js.map +0 -1
  191. package/dist/es5/lib/sources/utils/image-type.js +0 -2
  192. package/dist/es5/lib/sources/utils/image-type.js.map +0 -1
  193. package/dist/es5/lib/sources/utils/utils.js +0 -36
  194. package/dist/es5/lib/sources/utils/utils.js.map +0 -1
  195. package/dist/es5/lib/sources/vector-tile-source.js +0 -2
  196. package/dist/es5/lib/sources/vector-tile-source.js.map +0 -1
  197. package/dist/es5/lib/worker-loader-utils/create-loader-worker.js +0 -142
  198. package/dist/es5/lib/worker-loader-utils/create-loader-worker.js.map +0 -1
  199. package/dist/es5/lib/worker-loader-utils/encode-with-worker.js +0 -18
  200. package/dist/es5/lib/worker-loader-utils/encode-with-worker.js.map +0 -1
  201. package/dist/es5/lib/worker-loader-utils/parse-with-worker.js +0 -115
  202. package/dist/es5/lib/worker-loader-utils/parse-with-worker.js.map +0 -1
  203. package/dist/es5/loader-types.js +0 -58
  204. package/dist/es5/loader-types.js.map +0 -1
  205. package/dist/es5/service-types.js +0 -2
  206. package/dist/es5/service-types.js.map +0 -1
  207. package/dist/es5/types.js +0 -2
  208. package/dist/es5/types.js.map +0 -1
  209. package/dist/es5/workers/json-worker.js +0 -6
  210. package/dist/es5/workers/json-worker.js.map +0 -1
  211. package/dist/es5/writer-types.js +0 -2
  212. package/dist/es5/writer-types.js.map +0 -1
  213. package/dist/esm/index.js +0 -36
  214. package/dist/esm/index.js.map +0 -1
  215. package/dist/esm/json-loader.js.map +0 -1
  216. package/dist/esm/lib/binary-utils/array-buffer-utils.js.map +0 -1
  217. package/dist/esm/lib/binary-utils/dataview-copy-utils.js.map +0 -1
  218. package/dist/esm/lib/binary-utils/get-first-characters.js.map +0 -1
  219. package/dist/esm/lib/binary-utils/memory-conversion-utils.js.map +0 -1
  220. package/dist/esm/lib/binary-utils/memory-copy-utils.js.map +0 -1
  221. package/dist/esm/lib/env-utils/assert.js.map +0 -1
  222. package/dist/esm/lib/env-utils/globals.js.map +0 -1
  223. package/dist/esm/lib/file-provider/data-view-file.js.map +0 -1
  224. package/dist/esm/lib/file-provider/file-handle-file.js +0 -59
  225. package/dist/esm/lib/file-provider/file-handle-file.js.map +0 -1
  226. package/dist/esm/lib/file-provider/file-handle.js +0 -33
  227. package/dist/esm/lib/file-provider/file-handle.js.map +0 -1
  228. package/dist/esm/lib/file-provider/file-provider.js.map +0 -1
  229. package/dist/esm/lib/filesystems/filesystem.js.map +0 -1
  230. package/dist/esm/lib/filesystems/node-filesystem.browser.js +0 -42
  231. package/dist/esm/lib/filesystems/node-filesystem.browser.js.map +0 -1
  232. package/dist/esm/lib/filesystems/node-filesystem.js +0 -53
  233. package/dist/esm/lib/filesystems/node-filesystem.js.map +0 -1
  234. package/dist/esm/lib/filesystems/readable-file.js +0 -20
  235. package/dist/esm/lib/filesystems/readable-file.js.map +0 -1
  236. package/dist/esm/lib/filesystems/writable-file.js +0 -20
  237. package/dist/esm/lib/filesystems/writable-file.js.map +0 -1
  238. package/dist/esm/lib/iterators/async-iteration.js.map +0 -1
  239. package/dist/esm/lib/iterators/text-iterators.js.map +0 -1
  240. package/dist/esm/lib/node/buffer.browser.js.map +0 -1
  241. package/dist/esm/lib/node/buffer.js.map +0 -1
  242. package/dist/esm/lib/node/fs.browser.js.map +0 -1
  243. package/dist/esm/lib/node/fs.js +0 -29
  244. package/dist/esm/lib/node/fs.js.map +0 -1
  245. package/dist/esm/lib/node/promisify.js.map +0 -1
  246. package/dist/esm/lib/node/stream.browser.js.map +0 -1
  247. package/dist/esm/lib/node/stream.js.map +0 -1
  248. package/dist/esm/lib/option-utils/merge-loader-options.js.map +0 -1
  249. package/dist/esm/lib/parser-utils/parse-json.js +0 -9
  250. package/dist/esm/lib/parser-utils/parse-json.js.map +0 -1
  251. package/dist/esm/lib/path-utils/file-aliases.js.map +0 -1
  252. package/dist/esm/lib/path-utils/get-cwd.js.map +0 -1
  253. package/dist/esm/lib/path-utils/path.js.map +0 -1
  254. package/dist/esm/lib/request-utils/request-scheduler.js.map +0 -1
  255. package/dist/esm/lib/sources/data-source.js.map +0 -1
  256. package/dist/esm/lib/sources/image-source.js +0 -6
  257. package/dist/esm/lib/sources/image-source.js.map +0 -1
  258. package/dist/esm/lib/sources/image-tile-source.js.map +0 -1
  259. package/dist/esm/lib/sources/tile-source.js.map +0 -1
  260. package/dist/esm/lib/sources/utils/image-type.js.map +0 -1
  261. package/dist/esm/lib/sources/utils/utils.js.map +0 -1
  262. package/dist/esm/lib/sources/vector-tile-source.js.map +0 -1
  263. package/dist/esm/lib/worker-loader-utils/create-loader-worker.js.map +0 -1
  264. package/dist/esm/lib/worker-loader-utils/encode-with-worker.js.map +0 -1
  265. package/dist/esm/lib/worker-loader-utils/parse-with-worker.js.map +0 -1
  266. package/dist/esm/loader-types.js.map +0 -1
  267. package/dist/esm/service-types.js.map +0 -1
  268. package/dist/esm/types.js.map +0 -1
  269. package/dist/esm/workers/json-worker.js +0 -4
  270. package/dist/esm/workers/json-worker.js.map +0 -1
  271. package/dist/esm/writer-types.js.map +0 -1
  272. package/dist/lib/file-provider/file-handle.d.ts +0 -40
  273. package/dist/lib/file-provider/file-handle.d.ts.map +0 -1
  274. package/dist/lib/filesystems/node-filesystem.browser.d.ts +0 -39
  275. package/dist/lib/filesystems/node-filesystem.browser.d.ts.map +0 -1
  276. package/dist/lib/filesystems/node-filesystem.d.ts +0 -39
  277. package/dist/lib/filesystems/node-filesystem.d.ts.map +0 -1
  278. package/dist/lib/filesystems/readable-file.d.ts +0 -10
  279. package/dist/lib/filesystems/readable-file.d.ts.map +0 -1
  280. package/dist/lib/filesystems/writable-file.d.ts +0 -18
  281. package/dist/lib/filesystems/writable-file.d.ts.map +0 -1
  282. package/dist/lib/node/fs.d.ts +0 -30
  283. package/dist/lib/node/fs.d.ts.map +0 -1
  284. package/src/lib/file-provider/file-handle.ts +0 -79
  285. package/src/lib/filesystems/node-filesystem.browser.ts +0 -61
  286. package/src/lib/filesystems/node-filesystem.ts +0 -79
  287. package/src/lib/filesystems/readable-file.ts +0 -30
  288. package/src/lib/filesystems/writable-file.ts +0 -44
  289. package/src/lib/node/fs.ts +0 -49
  290. /package/dist/{esm/lib → lib}/binary-utils/array-buffer-utils.js +0 -0
  291. /package/dist/{esm/lib → lib}/binary-utils/get-first-characters.js +0 -0
  292. /package/dist/{esm/lib → lib}/env-utils/assert.js +0 -0
  293. /package/dist/{esm/lib → lib}/env-utils/globals.js +0 -0
  294. /package/dist/{esm/lib → lib}/file-provider/file-provider.js +0 -0
  295. /package/dist/{esm/lib → lib}/filesystems/filesystem.js +0 -0
  296. /package/dist/{esm/lib → lib}/iterators/text-iterators.js +0 -0
  297. /package/dist/{esm/lib → lib}/node/buffer.browser.js +0 -0
  298. /package/dist/{esm/lib → lib}/node/buffer.js +0 -0
  299. /package/dist/{esm/lib → lib}/node/fs.browser.js +0 -0
  300. /package/dist/{esm/lib → lib}/node/promisify.js +0 -0
  301. /package/dist/{esm/lib → lib}/node/stream.browser.js +0 -0
  302. /package/dist/{esm/lib → lib}/node/stream.js +0 -0
  303. /package/dist/{esm/lib → lib}/option-utils/merge-loader-options.js +0 -0
  304. /package/dist/{esm/lib → lib}/path-utils/get-cwd.js +0 -0
  305. /package/dist/{esm/lib → lib}/sources/image-tile-source.js +0 -0
  306. /package/dist/{esm/lib → lib}/sources/tile-source.js +0 -0
  307. /package/dist/{esm/lib → lib}/sources/utils/image-type.js +0 -0
  308. /package/dist/{esm/lib → lib}/sources/utils/utils.js +0 -0
  309. /package/dist/{esm/lib → lib}/sources/vector-tile-source.js +0 -0
  310. /package/dist/{esm/loader-types.js → loader-types.js} +0 -0
  311. /package/dist/{esm/service-types.js → service-types.js} +0 -0
  312. /package/dist/{esm/types.js → types.js} +0 -0
  313. /package/dist/{esm/writer-types.js → writer-types.js} +0 -0
package/dist/index.d.ts CHANGED
@@ -23,21 +23,18 @@ export { isBuffer, toBuffer, toArrayBuffer } from './lib/binary-utils/memory-con
23
23
  export { promisify1, promisify2 } from './lib/node/promisify';
24
24
  import * as path from './lib/path-utils/path';
25
25
  export { path };
26
- import * as fs from './lib/node/fs';
27
- export { fs };
28
26
  import * as stream from './lib/node/stream';
29
27
  export { stream };
30
- export type { FileSystem, RandomAccessReadFileSystem } from './lib/filesystems/filesystem';
31
- export { NodeFileSystem as _NodeFileSystem } from './lib/filesystems/node-filesystem';
28
+ export type { ReadableFile, WritableFile, Stat } from './lib/files/file';
29
+ export { BlobFile } from './lib/files/blob-file';
30
+ export { HttpFile } from './lib/files/http-file';
31
+ export { NodeFileFacade as NodeFile } from './lib/files/node-file-facade';
32
+ export type { FileSystem, RandomAccessFileSystem } from './lib/filesystems/filesystem';
33
+ export { NodeFileSystemFacade as NodeFilesystem } from './lib/filesystems/node-filesystem-facade';
32
34
  export type { FileProvider } from './lib/file-provider/file-provider';
33
35
  export { isFileProvider } from './lib/file-provider/file-provider';
34
- export { FileHandle } from './lib/file-provider/file-handle';
35
36
  export { FileHandleFile } from './lib/file-provider/file-handle-file';
36
37
  export { DataViewFile } from './lib/file-provider/data-view-file';
37
- export type { ReadableFile } from './lib/filesystems/readable-file';
38
- export { makeReadableFile } from './lib/filesystems/readable-file';
39
- export type { WritableFile } from './lib/filesystems/writable-file';
40
- export { makeWritableFile } from './lib/filesystems/writable-file';
41
38
  export type { Service } from './service-types';
42
39
  export type { DataSourceProps } from './lib/sources/data-source';
43
40
  export { DataSource } from './lib/sources/data-source';
@@ -45,7 +42,7 @@ export type { ImageType } from './lib/sources/utils/image-type';
45
42
  export type { ImageSourceProps, ImageSourceMetadata } from './lib/sources/image-source';
46
43
  export type { GetImageParameters } from './lib/sources/image-source';
47
44
  export { ImageSource } from './lib/sources/image-source';
48
- export type { TileSourceProps, TileSourceMetadata, GetTileParameters } from './lib/sources/tile-source';
45
+ export type { TileSourceProps, TileSourceMetadata, GetTileParameters, TileLoadParameters } from './lib/sources/tile-source';
49
46
  export type { TileSource } from './lib/sources/tile-source';
50
47
  export type { ImageTileSource } from './lib/sources/image-tile-source';
51
48
  export type { VectorTileSource } from './lib/sources/vector-tile-source';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAIA,YAAY,EAEV,QAAQ,EACR,YAAY,EACZ,iBAAiB,EAEjB,UAAU,EACV,aAAa,EACb,qBAAqB,EACrB,wBAAwB,EACxB,WAAW,EACX,YAAY,EAEZ,SAAS,EACV,MAAM,SAAS,CAAC;AAIjB,YAAY,EACV,MAAM,EACN,gBAAgB,EAChB,aAAa,EACb,aAAa,EACb,iBAAiB,EACjB,gBAAgB,EAChB,eAAe,EAChB,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAAC,gBAAgB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AM,kCAAkC,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,34 @@
1
+ export { parseFromContext, parseSyncFromContext, parseInBatchesFromContext } from "./loader-types.js";
2
+ export { assert } from "./lib/env-utils/assert.js";
3
+ export { isBrowser, isWorker, nodeVersion, self, window, global, document } from "./lib/env-utils/globals.js";
4
+ export { mergeLoaderOptions } from "./lib/option-utils/merge-loader-options.js";
5
+ export { createLoaderWorker } from "./lib/worker-loader-utils/create-loader-worker.js";
6
+ export { parseWithWorker, canParseWithWorker } from "./lib/worker-loader-utils/parse-with-worker.js";
7
+ export { canEncodeWithWorker } from "./lib/worker-loader-utils/encode-with-worker.js";
8
+ export { parseJSON } from "./lib/parser-utils/parse-json.js";
9
+ export { sliceArrayBuffer, concatenateArrayBuffers, concatenateTypedArrays, compareArrayBuffers } from "./lib/binary-utils/array-buffer-utils.js";
10
+ export { padToNBytes, copyToArray, copyArrayBuffer } from "./lib/binary-utils/memory-copy-utils.js";
11
+ export { padStringToByteAlignment, copyStringToDataView, copyBinaryToDataView, copyPaddedArrayBufferToDataView, copyPaddedStringToDataView } from "./lib/binary-utils/dataview-copy-utils.js";
12
+ export { getFirstCharacters, getMagicString } from "./lib/binary-utils/get-first-characters.js";
13
+ export { makeTextEncoderIterator, makeTextDecoderIterator, makeLineIterator, makeNumberedLineIterator } from "./lib/iterators/text-iterators.js";
14
+ export { forEach, concatenateArrayBuffersAsync } from "./lib/iterators/async-iteration.js";
15
+ export { default as RequestScheduler } from "./lib/request-utils/request-scheduler.js";
16
+ export { setPathPrefix, getPathPrefix, resolvePath } from "./lib/path-utils/file-aliases.js";
17
+ export { addAliases as _addAliases } from "./lib/path-utils/file-aliases.js";
18
+ export { JSONLoader } from "./json-loader.js";
19
+ export { isBuffer, toBuffer, toArrayBuffer } from "./lib/binary-utils/memory-conversion-utils.js";
20
+ export { promisify1, promisify2 } from "./lib/node/promisify.js";
21
+ import * as path from "./lib/path-utils/path.js";
22
+ export { path };
23
+ import * as stream from "./lib/node/stream.js";
24
+ export { stream };
25
+ export { BlobFile } from "./lib/files/blob-file.js";
26
+ export { HttpFile } from "./lib/files/http-file.js";
27
+ export { NodeFileFacade as NodeFile } from "./lib/files/node-file-facade.js";
28
+ export { NodeFileSystemFacade as NodeFilesystem } from "./lib/filesystems/node-filesystem-facade.js";
29
+ export { isFileProvider } from "./lib/file-provider/file-provider.js";
30
+ export { FileHandleFile } from "./lib/file-provider/file-handle-file.js";
31
+ export { DataViewFile } from "./lib/file-provider/data-view-file.js";
32
+ export { DataSource } from "./lib/sources/data-source.js";
33
+ export { ImageSource } from "./lib/sources/image-source.js";
34
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":["parseFromContext","parseSyncFromContext","parseInBatchesFromContext","assert","isBrowser","isWorker","nodeVersion","self","window","global","document","mergeLoaderOptions","createLoaderWorker","parseWithWorker","canParseWithWorker","canEncodeWithWorker","parseJSON","sliceArrayBuffer","concatenateArrayBuffers","concatenateTypedArrays","compareArrayBuffers","padToNBytes","copyToArray","copyArrayBuffer","padStringToByteAlignment","copyStringToDataView","copyBinaryToDataView","copyPaddedArrayBufferToDataView","copyPaddedStringToDataView","getFirstCharacters","getMagicString","makeTextEncoderIterator","makeTextDecoderIterator","makeLineIterator","makeNumberedLineIterator","forEach","concatenateArrayBuffersAsync","default","RequestScheduler","setPathPrefix","getPathPrefix","resolvePath","addAliases","_addAliases","JSONLoader","isBuffer","toBuffer","toArrayBuffer","promisify1","promisify2","path","stream","BlobFile","HttpFile","NodeFileFacade","NodeFile","NodeFileSystemFacade","NodeFilesystem","isFileProvider","FileHandleFile","DataViewFile","DataSource","ImageSource"],"sources":["../src/index.ts"],"sourcesContent":["// loaders.gl, MIT license\n\n// TYPES\n\nexport type {\n // misc\n DataType,\n SyncDataType,\n BatchableDataType,\n // numeric array types\n TypedArray,\n BigTypedArray,\n TypedArrayConstructor,\n BigTypedArrayConstructor,\n NumberArray,\n NumericArray,\n // fetch\n FetchLike\n} from './types';\n\n// loaders\n\nexport type {\n Loader,\n LoaderWithParser,\n LoaderContext,\n LoaderOptions,\n LoaderOptionsType,\n LoaderReturnType,\n LoaderBatchType\n} from './loader-types';\n\nexport {parseFromContext, parseSyncFromContext, parseInBatchesFromContext} from './loader-types';\n\n// writers\n\nexport type {Writer, WriterOptions, WriterOptionsType} from './writer-types';\n\n// GENERAL UTILS\nexport {assert} from './lib/env-utils/assert';\nexport {\n isBrowser,\n isWorker,\n nodeVersion,\n self,\n window,\n global,\n document\n} from './lib/env-utils/globals';\n\nexport {mergeLoaderOptions} from './lib/option-utils/merge-loader-options';\n\n// LOADERS.GL-SPECIFIC WORKER UTILS\nexport {createLoaderWorker} from './lib/worker-loader-utils/create-loader-worker';\nexport {parseWithWorker, canParseWithWorker} from './lib/worker-loader-utils/parse-with-worker';\nexport {canEncodeWithWorker} from './lib/worker-loader-utils/encode-with-worker';\n\n// PARSER UTILS\nexport {parseJSON} from './lib/parser-utils/parse-json';\n\n// MEMORY COPY UTILS\nexport {\n sliceArrayBuffer,\n concatenateArrayBuffers,\n concatenateTypedArrays,\n compareArrayBuffers\n} from './lib/binary-utils/array-buffer-utils';\nexport {padToNBytes, copyToArray, copyArrayBuffer} from './lib/binary-utils/memory-copy-utils';\nexport {\n padStringToByteAlignment,\n copyStringToDataView,\n copyBinaryToDataView,\n copyPaddedArrayBufferToDataView,\n copyPaddedStringToDataView\n} from './lib/binary-utils/dataview-copy-utils';\nexport {getFirstCharacters, getMagicString} from './lib/binary-utils/get-first-characters';\n\n// ITERATOR UTILS\nexport {\n makeTextEncoderIterator,\n makeTextDecoderIterator,\n makeLineIterator,\n makeNumberedLineIterator\n} from './lib/iterators/text-iterators';\nexport {forEach, concatenateArrayBuffersAsync} from './lib/iterators/async-iteration';\n\n// REQUEST UTILS\nexport {default as RequestScheduler} from './lib/request-utils/request-scheduler';\n\n// PATH HELPERS\nexport {setPathPrefix, getPathPrefix, resolvePath} from './lib/path-utils/file-aliases';\nexport {addAliases as _addAliases} from './lib/path-utils/file-aliases';\n\n// MICRO LOADERS\nexport {JSONLoader} from './json-loader';\n\n// NODE support\n\n// Node.js emulation (can be used in browser)\n\n// Avoid direct use of `Buffer` which pulls in 50KB polyfill\nexport {isBuffer, toBuffer, toArrayBuffer} from './lib/binary-utils/memory-conversion-utils';\n\n// Note.js wrappers (can be safely imported, but not used in browser)\n\n// Use instead of importing 'util' to avoid node dependencies\nexport {promisify1, promisify2} from './lib/node/promisify';\n\n// `path` replacement (avoids bundling big path polyfill)\nimport * as path from './lib/path-utils/path';\nexport {path};\n\n// Use instead of importing 'stream' to avoid node dependencies`\nimport * as stream from './lib/node/stream';\nexport {stream};\n\n// EXPERIMENTAL: FILE SYSTEMS\n\nexport type {ReadableFile, WritableFile, Stat} from './lib/files/file';\nexport {BlobFile} from './lib/files/blob-file';\nexport {HttpFile} from './lib/files/http-file';\nexport {NodeFileFacade as NodeFile} from './lib/files/node-file-facade';\n\nexport type {FileSystem, RandomAccessFileSystem} from './lib/filesystems/filesystem';\nexport {NodeFileSystemFacade as NodeFilesystem} from './lib/filesystems/node-filesystem-facade';\n\n// TODO - replace with ReadableFile\nexport type {FileProvider} from './lib/file-provider/file-provider';\nexport {isFileProvider} from './lib/file-provider/file-provider';\nexport {FileHandleFile} from './lib/file-provider/file-handle-file';\nexport {DataViewFile} from './lib/file-provider/data-view-file';\n\n// EXPERIMENTAL: DATA SOURCES\nexport type {Service} from './service-types';\n\nexport type {DataSourceProps} from './lib/sources/data-source';\nexport {DataSource} from './lib/sources/data-source';\n\nexport type {ImageType} from './lib/sources/utils/image-type';\nexport type {ImageSourceProps, ImageSourceMetadata} from './lib/sources/image-source';\nexport type {GetImageParameters} from './lib/sources/image-source';\nexport {ImageSource} from './lib/sources/image-source';\n\nexport type {\n TileSourceProps,\n TileSourceMetadata,\n GetTileParameters,\n TileLoadParameters\n} from './lib/sources/tile-source';\nexport type {TileSource} from './lib/sources/tile-source';\n\nexport type {ImageTileSource} from './lib/sources/image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.0.0-beta.1" !== 'undefined' ? "4.0.0-beta.1" : 'latest';
1
+ const VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'latest';
2
2
  export const JSONLoader = {
3
3
  name: 'JSON',
4
4
  id: 'json',
@@ -0,0 +1 @@
1
+ {"version":3,"file":"json-loader.js","names":["VERSION","__VERSION__","JSONLoader","name","id","module","version","extensions","mimeTypes","category","text","parseTextSync","parse","arrayBuffer","TextDecoder","decode","options","JSON"],"sources":["../src/json-loader.ts"],"sourcesContent":["import type {LoaderWithParser, LoaderOptions} from './loader-types';\nimport type {Table, TableBatch} from '@loaders.gl/schema';\n\n// __VERSION__ is injected by babel-plugin-version-inline\n// @ts-ignore TS2304: Cannot find name '__VERSION__'.\nconst VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'latest';\n\nexport type JSONLoaderOptions = LoaderOptions;\n\n/**\n * A JSON Micro loader (minimal bundle size)\n * Alternative to `@loaders.gl/json`\n */\nexport const JSONLoader: LoaderWithParser<Table, TableBatch, JSONLoaderOptions> = {\n name: 'JSON',\n id: 'json',\n module: 'json',\n version: VERSION,\n extensions: ['json', 'geojson'],\n mimeTypes: ['application/json'],\n category: 'json',\n text: true,\n parseTextSync,\n parse: async (arrayBuffer) => parseTextSync(new TextDecoder().decode(arrayBuffer)),\n options: {}\n};\n\n// TODO - deprecated\nfunction parseTextSync(text) {\n return JSON.parse(text);\n}\n"],"mappings":"AAKA,MAAMA,OAAO,GAAG,OAAOC,WAAW,KAAK,WAAW,GAAGA,WAAW,GAAG,QAAQ;AAQ3E,OAAO,MAAMC,UAAkE,GAAG;EAChFC,IAAI,EAAE,MAAM;EACZC,EAAE,EAAE,MAAM;EACVC,MAAM,EAAE,MAAM;EACdC,OAAO,EAAEN,OAAO;EAChBO,UAAU,EAAE,CAAC,MAAM,EAAE,SAAS,CAAC;EAC/BC,SAAS,EAAE,CAAC,kBAAkB,CAAC;EAC/BC,QAAQ,EAAE,MAAM;EAChBC,IAAI,EAAE,IAAI;EACVC,aAAa;EACbC,KAAK,EAAE,MAAOC,WAAW,IAAKF,aAAa,CAAC,IAAIG,WAAW,CAAC,CAAC,CAACC,MAAM,CAACF,WAAW,CAAC,CAAC;EAClFG,OAAO,EAAE,CAAC;AACZ,CAAC;AAGD,SAASL,aAAaA,CAACD,IAAI,EAAE;EAC3B,OAAOO,IAAI,CAACL,KAAK,CAACF,IAAI,CAAC;AACzB"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"array-buffer-utils.js","names":["compareArrayBuffers","arrayBuffer1","arrayBuffer2","byteLength","array1","Uint8Array","array2","i","length","concatenateArrayBuffers","_len","arguments","sources","Array","_key","sourceArrays","map","source2","ArrayBuffer","reduce","typedArray","result","offset","sourceArray","set","buffer","concatenateTypedArrays","_len2","typedArrays","_key2","arrays","TypedArrayConstructor","constructor","Error","sumLength","acc","value","array","sliceArrayBuffer","arrayBuffer","byteOffset","subArray","undefined","subarray","arrayCopy"],"sources":["../../../src/lib/binary-utils/array-buffer-utils.ts"],"sourcesContent":["import {TypedArray} from '../../types';\n\n/**\n * compare two binary arrays for equality\n * @param a\n * @param b\n * @param byteLength\n */\nexport function compareArrayBuffers(\n arrayBuffer1: ArrayBuffer,\n arrayBuffer2: ArrayBuffer,\n byteLength?: number\n): boolean {\n byteLength = byteLength || arrayBuffer1.byteLength;\n if (arrayBuffer1.byteLength < byteLength || arrayBuffer2.byteLength < byteLength) {\n return false;\n }\n const array1 = new Uint8Array(arrayBuffer1);\n const array2 = new Uint8Array(arrayBuffer2);\n for (let i = 0; i < array1.length; ++i) {\n if (array1[i] !== array2[i]) {\n return false;\n }\n }\n return true;\n}\n\n/**\n * Concatenate a sequence of ArrayBuffers\n * @return A concatenated ArrayBuffer\n */\nexport function concatenateArrayBuffers(...sources: (ArrayBuffer | Uint8Array)[]): ArrayBuffer {\n // Make sure all inputs are wrapped in typed arrays\n const sourceArrays = sources.map((source2) =>\n source2 instanceof ArrayBuffer ? new Uint8Array(source2) : source2\n );\n\n // Get length of all inputs\n const byteLength = sourceArrays.reduce((length, typedArray) => length + typedArray.byteLength, 0);\n\n // Allocate array with space for all inputs\n const result = new Uint8Array(byteLength);\n\n // Copy the subarrays\n let offset = 0;\n for (const sourceArray of sourceArrays) {\n result.set(sourceArray, offset);\n offset += sourceArray.byteLength;\n }\n\n // We work with ArrayBuffers, discard the typed array wrapper\n return result.buffer;\n}\n\n/**\n * Concatenate arbitrary count of typed arrays\n * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Typed_arrays\n * @param - list of arrays. All arrays should be the same type\n * @return A concatenated TypedArray\n */\nexport function concatenateTypedArrays<T>(...typedArrays: T[]): T {\n // @ts-ignore\n const arrays = typedArrays as TypedArray[];\n // @ts-ignore\n const TypedArrayConstructor = (arrays && arrays.length > 1 && arrays[0].constructor) || null;\n if (!TypedArrayConstructor) {\n throw new Error(\n '\"concatenateTypedArrays\" - incorrect quantity of arguments or arguments have incompatible data types'\n );\n }\n\n const sumLength = arrays.reduce((acc, value) => acc + value.length, 0);\n // @ts-ignore typescript does not like dynamic constructors\n const result = new TypedArrayConstructor(sumLength);\n let offset = 0;\n for (const array of arrays) {\n result.set(array, offset);\n offset += array.length;\n }\n return result;\n}\n\n/**\n * Copy a view of an ArrayBuffer into new ArrayBuffer with byteOffset = 0\n * @param arrayBuffer\n * @param byteOffset\n * @param byteLength\n */\nexport function sliceArrayBuffer(\n arrayBuffer: ArrayBuffer,\n byteOffset: number,\n byteLength?: number\n): ArrayBuffer {\n const subArray =\n byteLength !== undefined\n ? new Uint8Array(arrayBuffer).subarray(byteOffset, byteOffset + byteLength)\n : new Uint8Array(arrayBuffer).subarray(byteOffset);\n const arrayCopy = new Uint8Array(subArray);\n return arrayCopy.buffer;\n}\n"],"mappings":"AAQA,OAAO,SAASA,mBAAmBA,CACjCC,YAAyB,EACzBC,YAAyB,EACzBC,UAAmB,EACV;EACTA,UAAU,GAAGA,UAAU,IAAIF,YAAY,CAACE,UAAU;EAClD,IAAIF,YAAY,CAACE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C;EAC1C,OAAOG,SAAS,CAACnB,MAAM;AACzB"}
@@ -1,4 +1,4 @@
1
- import { padToNBytes } from './memory-copy-utils';
1
+ import { padToNBytes } from "./memory-copy-utils.js";
2
2
  export function padStringToByteAlignment(string, byteAlignment) {
3
3
  const length = string.length;
4
4
  const paddedLength = Math.ceil(length / byteAlignment) * byteAlignment;
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dataview-copy-utils.js","names":["padToNBytes","padStringToByteAlignment","string","byteAlignment","length","paddedLength","Math","ceil","padding","whitespace","i","copyStringToDataView","dataView","byteOffset","byteLength","setUint8","charCodeAt","copyBinaryToDataView","binary","copyPaddedArrayBufferToDataView","sourceBuffer","padLength","targetArray","Uint8Array","buffer","sourceArray","set","copyPaddedStringToDataView","textEncoder","TextEncoder","stringBuffer","encode"],"sources":["../../../src/lib/binary-utils/dataview-copy-utils.ts"],"sourcesContent":["// loaders./gl, MIT license\n\nimport {TypedArray} from '../../types';\nimport {padToNBytes} from './memory-copy-utils';\n\n/**\n * Helper function that pads a string with spaces to fit a certain byte alignment\n * @param string\n * @param byteAlignment\n * @returns\n *\n * @todo PERFORMANCE IDEA: No need to copy string twice...\n */\nexport function padStringToByteAlignment(string: string, byteAlignment: number): string {\n const length = string.length;\n const paddedLength = Math.ceil(length / byteAlignment) * byteAlignment; // Round up to the required alignment\n const padding = paddedLength - length;\n let whitespace = '';\n for (let i = 0; i < padding; ++i) {\n whitespace += ' ';\n }\n return string + whitespace;\n}\n\n/**\n *\n * @param dataView\n * @param byteOffset\n * @param string\n * @param byteLength\n * @returns\n */\nexport function copyStringToDataView(\n dataView: DataView,\n byteOffset: number,\n string: string,\n byteLength: number\n): number {\n if (dataView) {\n for (let i = 0; i < byteLength; i++) {\n dataView.setUint8(byteOffset + i, string.charCodeAt(i));\n }\n }\n return byteOffset + byteLength;\n}\n\nexport function copyBinaryToDataView(dataView, byteOffset, binary, byteLength) {\n if (dataView) {\n for (let i = 0; i < byteLength; i++) {\n dataView.setUint8(byteOffset + i, binary[i]);\n }\n }\n return byteOffset + byteLength;\n}\n\n/**\n * Copy sourceBuffer to dataView with some padding\n *\n * @param dataView - destination data container. If null - only new offset is calculated\n * @param byteOffset - destination byte offset to copy to\n * @param sourceBuffer - source data buffer\n * @param padding - pad the resulting array to multiple of \"padding\" bytes. Additional bytes are filled with 0x20 (ASCII space)\n *\n * @return new byteOffset of resulting dataView\n */\nexport function copyPaddedArrayBufferToDataView(\n dataView: DataView | null,\n byteOffset: number,\n sourceBuffer: TypedArray,\n padding: number\n): number {\n const paddedLength = padToNBytes(sourceBuffer.byteLength, padding);\n const padLength = paddedLength - sourceBuffer.byteLength;\n\n if (dataView) {\n // Copy array\n const targetArray = new Uint8Array(\n dataView.buffer,\n dataView.byteOffset + byteOffset,\n sourceBuffer.byteLength\n );\n const sourceArray = new Uint8Array(sourceBuffer);\n targetArray.set(sourceArray);\n\n // Add PADDING\n for (let i = 0; i < padLength; ++i) {\n // json chunk is padded with spaces (ASCII 0x20)\n dataView.setUint8(byteOffset + sourceBuffer.byteLength + i, 0x20);\n }\n }\n byteOffset += paddedLength;\n return byteOffset;\n}\n\n/**\n * Copy string to dataView with some padding\n *\n * @param {DataView | null} dataView - destination data container. If null - only new offset is calculated\n * @param {number} byteOffset - destination byte offset to copy to\n * @param {string} string - source string\n * @param {number} padding - pad the resulting array to multiple of \"padding\" bytes. Additional bytes are filled with 0x20 (ASCII space)\n *\n * @return new byteOffset of resulting dataView\n */\nexport function copyPaddedStringToDataView(\n dataView: DataView | null,\n byteOffset: number,\n string: string,\n padding: number\n): number {\n const textEncoder = new TextEncoder();\n // PERFORMANCE IDEA: We encode twice, once to get size and once to store\n // PERFORMANCE IDEA: Use TextEncoder.encodeInto() to avoid temporary copy\n const stringBuffer = textEncoder.encode(string);\n\n byteOffset = copyPaddedArrayBufferToDataView(dataView, byteOffset, stringBuffer, padding);\n\n return byteOffset;\n}\n"],"mappings":"SAGQA,WAAW;AAUnB,OAAO,SAASC,wBAAwBA,CA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AY,CAACN,UAAU,EAAEN,OAAO,CAAC;EAClE,MAAMa,SAAS,GAAGhB,YAAY,GAAGe,YAAY,CAACN,UAAU;EAExD,IAAIF,QAAQ,EAAE;IAEZ,MAAMU,WAAW,GAAG,IAAIC,UAAU,CAChCX,QAAQ,CAACY,MAAM,EACfZ,QAAQ,CAACC,UAAU,GAAGA,UAAU,EAChCO,YAAY,CAACN,UACf,CAAC;IACD,MAAMW,WAAW,GAAG,IAAIF,UAAU,CAACH,YAAY,CAAC;IAChDE,WAAW,CAACI,GAAG,CAACD,WAAW,CAAC;IAG5B,KAAK,IAAIf,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGW,SAAS,EAAE,EAAEX,CAAC,EAAE;MAElCE,QAAQ,CAACG,QAAQ,CAACF,UAAU,GAAGO,YAAY,CAACN,UAAU,GAAGJ,CAAC,EAAE,IAAI,CAAC;IACnE;EACF;EACAG,UAAU,IAAIR,YAAY;EAC1B,OAAOQ,UAAU;AACnB;AAYA,OAAO,SAASc,0BAA0BA,CACxCf,QAAyB,EACzBC,UAAkB,EAClBX,MAAc,EACdM,OAAe,EACP;EACR,MAAMoB,WAAW,GAAG,IAAIC,WAAW,CAAC,CAAC;EAGrC,MAAMC,YAAY,GAAGF,WAAW,CAACG,MAAM,CAAC7B,MAAM,CAAC;EAE/CW,UAAU,GAAGM,+BAA+B,CAACP,QAAQ,EAAEC,UAAU,EAAEiB,YAAY,EAAEtB,OAAO,CAAC;EAEzF,OAAOK,UAAU;AACnB"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-first-characters.js","names":["getFirstCharacters","data","length","arguments","undefined","slice","ArrayBuffer","isView","getMagicString","buffer","byteOffset","arrayBuffer","byteLength","dataView","DataView","magic","i","String","fromCharCode","getUint8"],"sources":["../../../src/lib/binary-utils/get-first-characters.ts"],"sourcesContent":["// loaders.gl, MIT license\n\n/**\n * Get the first characters from a binary file (interpret the first bytes as an ASCII string)\n * @param data\n * @param length\n * @returns\n */\nexport function getFirstCharacters(data: string | ArrayBuffer, length: number = 5): string {\n if (typeof data === 'string') {\n return data.slice(0, length);\n } else if (ArrayBuffer.isView(data)) {\n // Typed Arrays can have offsets into underlying buffer\n return getMagicString(data.buffer, data.byteOffset, length);\n } else if (data instanceof ArrayBuffer) {\n const byteOffset = 0;\n return getMagicString(data, byteOffset, length);\n }\n return '';\n}\n\n/**\n * Gets a magic string from a \"file\"\n * Typically used to check or detect file format\n * @param arrayBuffer\n * @param byteOffset\n * @param length\n * @returns\n */\nexport function getMagicString(\n arrayBuffer: ArrayBuffer,\n byteOffset: number,\n length: number\n): string {\n if (arrayBuffer.byteLength <= byteOffset + length) {\n return '';\n }\n const dataView = new DataView(arrayBuffer);\n let magic = '';\n for (let i = 0; i < length; i++) {\n magic += String.fromCharCode(dataView.getUint8(byteOffset + i));\n }\n return magic;\n}\n"],"mappings":"AAQA,OAAO,SAASA,kBAAkBA,CAACC,IAA0B,EAA8B;EAAA,IAA5BC,MAAc,GAAAC,SAAA,CAAAD,MAAA,QAAAC,SAAA,QAAAC,SAAA,GAAAD,SAAA,MAAG,CAAC;EAC/E,IAAI,OAAOF,IAAI,KAAK,QAAQ,EAAE;IAC5B,OAAOA,IAAI,CAACI,KAAK,CAAC,CAAC,EAAEH,MAAM,CAAC;EAC9B,CAAC,MAAM,IAAII,WAAW,CAACC,MAAM,CAACN,IAAI,CAAC,EAAE;IAEnC,OAAOO,cAAc,CAACP,IAAI,CAACQ,MAAM,EAAER,IAAI,CAACS,UAAU,EAAER,MAAM,CAAC;EAC7D,CAAC,MAAM,IAAID,IAAI,YAAYK,WAAW,EAAE;IACtC,MAAMI,UAAU,GAAG,CAAC;IACpB,OAAOF,cAAc,CAACP,IAAI,EAAES,UAAU,EAAER,MAAM,CAAC;EACjD;EACA,OAAO,EAAE;AACX;AAUA,OAAO,SAASM,cAAcA,CAC5BG,WAAwB,EACxBD,UAAkB,EAClBR,MAAc,EACN;EACR,IAAIS,WAAW,CAACC,UAAU,IAAIF,UAAU,GAAGR,MAAM,EAAE;IACjD,OAAO,EAAE;EACX;EACA,MAAMW,QAAQ,GAAG,IAAIC,QAAQ,CAACH,WAAW,CAAC;EAC1C,IAAII,KAAK,GAAG,EAAE;EACd,KAAK,IAAIC,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGd,MAAM,EAAEc,CAAC,EAAE,EAAE;IAC/BD,KAAK,IAAIE,MAAM,CAACC,YAAY,CAACL,QAAQ,CAACM,QAAQ,CAACT,UAAU,GAAGM,CAAC,CAAC,CAAC;EACjE;EACA,OAAOD,KAAK;AACd"}
@@ -1,4 +1,4 @@
1
- import * as node from '../node/buffer';
1
+ import * as node from "../node/buffer.js";
2
2
  export function isBuffer(value) {
3
3
  return value && typeof value === 'object' && value.isBuffer;
4
4
  }
@@ -0,0 +1 @@
1
+ {"version":3,"file":"memory-conversion-utils.js","names":["node","isBuffer","value","toBuffer","data","toArrayBuffer","ArrayBuffer","isView","byteOffset","byteLength","buffer","slice","text","uint8Array","TextEncoder","encode","_toArrayBuffer","Error"],"sources":["../../../src/lib/binary-utils/memory-conversion-utils.ts"],"sourcesContent":["// loaders.gl, MIT license\n\nimport * as node from '../node/buffer';\n\n/**\n * Check for Node.js `Buffer` (without triggering bundler to include Buffer polyfill on browser)\n */\nexport function isBuffer(value: any): boolean {\n return value && typeof value === 'object' && value.isBuffer;\n}\n\n/**\n * Converts to Node.js `Buffer` (without triggering bundler to include Buffer polyfill on browser)\n * @todo better data type\n */\nexport function toBuffer(data: any): Buffer {\n return node.toBuffer ? node.toBuffer(data) : data;\n}\n\n/**\n * Convert an object to an array buffer\n */\nexport function toArrayBuffer(data: unknown): ArrayBuffer {\n // Note: Should be called first, Buffers can trigger other detections below\n if (isBuffer(data)) {\n return node.toArrayBuffer(data);\n }\n\n if (data instanceof ArrayBuffer) {\n return data;\n }\n\n // Careful - Node Buffers look like Uint8Arrays (keep after isBuffer)\n if (ArrayBuffer.isView(data)) {\n if (data.byteOffset === 0 && data.byteLength === data.buffer.byteLength) {\n return data.buffer;\n }\n return data.buffer.slice(data.byteOffset, data.byteOffset + data.byteLength);\n }\n\n if (typeof data === 'string') {\n const text = data;\n const uint8Array = new TextEncoder().encode(text);\n return uint8Array.buffer;\n }\n\n // HACK to support Blob polyfill\n if (data && typeof data === 'object' && (data as any)._toArrayBuffer) {\n return (data as any)._toArrayBuffer();\n }\n\n throw new Error('toArrayBuffer');\n}\n"],"mappings":"OAEO,KAAKA,IAAI;AAKhB,OAAO,SAASC,QAAQA,CAACC,KAAU,EAAW;EAC5C,OAAOA,KAAK,IAAI,OAAOA,KAAK,KAAK,QAAQ,IAAIA,KAAK,CAACD,QAAQ;AAC7D;AAMA,OAAO,SAASE,QAAQA,CAACC,IAAS,EAAU;EAC1C,OAAOJ,IAAI,CAACG,QAAQ,GAAGH,IAAI,CAACG,QAAQ,CAACC,IAAI,CAAC,GAAGA,IAAI;AACnD;AAKA,OAAO,SAASC,aAAaA,CAACD,IAAa,EAAe;EAExD,IAAIH,QAAQ,CAACG,IAAI,CAAC,EAAE;IAClB,OAAOJ,IAAI,CAACK,aAAa,CAACD,IAAI,CAAC;EACjC;EAEA,IAAIA,IAAI,YAAYE,WAAW,EAAE;IAC/B,OAAOF,IAAI;EACb;EAGA,IAAIE,WAAW,CAACC,MAAM,CAACH,IAAI,CAAC,EAAE;IAC5B,IAAIA,IAAI,CAACI,UAAU,KAAK,CAAC,IAAIJ,IAAI,CAACK,UAAU,KAAKL,IAAI,CAACM,MAAM,CAACD,UAAU,EAAE;MACvE,OAAOL,IAAI,CAACM,MAAM;IACpB;IACA,OAAON,IAAI,CAACM,MAAM,CAACC,KAAK,CAACP,IAAI,CAACI,UAAU,EAAEJ,IAAI,CAACI,UAAU,GAAGJ,IAAI,CAACK,UAAU,CAAC;EAC9E;EAEA,IAAI,OAAOL,IAAI,KAAK,QAAQ,EAAE;IAC5B,MAAMQ,IAAI,GAAGR,IAAI;IACjB,MAAMS,UAAU,GAAG,IAAIC,WAAW,CAAC,CAAC,CAACC,MAAM,CAACH,IAAI,CAAC;IACjD,OAAOC,UAAU,CAACH,MAAM;EAC1B;EAGA,IAAIN,IAAI,IAAI,OAAOA,IAAI,KAAK,QAAQ,IAAKA,IAAI,CAASY,cAAc,EAAE;IACpE,OAAQZ,IAAI,CAASY,cAAc,CAAC,CAAC;EACvC;EAEA,MAAM,IAAIC,KAAK,CAAC,eAAe,CAAC;AAClC"}
@@ -1,4 +1,4 @@
1
- import { assert } from '../env-utils/assert';
1
+ import { assert } from "../env-utils/assert.js";
2
2
  export function padToNBytes(byteLength, padding) {
3
3
  assert(byteLength >= 0);
4
4
  assert(padding > 0);
@@ -0,0 +1 @@
1
+ {"version":3,"file":"memory-copy-utils.js","names":["assert","padToNBytes","byteLength","padding","copyArrayBuffer","targetBuffer","sourceBuffer","byteOffset","arguments","length","undefined","targetArray","Uint8Array","sourceArray","set","copyToArray","source","target","targetOffset","ArrayBuffer","srcByteOffset","srcByteLength","buffer","arrayBuffer"],"sources":["../../../src/lib/binary-utils/memory-copy-utils.ts"],"sourcesContent":["import {assert} from '../env-utils/assert';\n\n/**\n * Calculate new size of an arrayBuffer to be aligned to an n-byte boundary\n * This function increases `byteLength` by the minimum delta,\n * allowing the total length to be divided by `padding`\n * @param byteLength\n * @param padding\n */\nexport function padToNBytes(byteLength: number, padding: number): number {\n assert(byteLength >= 0); // `Incorrect 'byteLength' value: ${byteLength}`\n assert(padding > 0); // `Incorrect 'padding' value: ${padding}`\n return (byteLength + (padding - 1)) & ~(padding - 1);\n}\n\n/**\n * Creates a new Uint8Array based on two different ArrayBuffers\n * @param targetBuffer The first buffer.\n * @param sourceBuffer The second buffer.\n * @return The new ArrayBuffer created out of the two.\n */\nexport function copyArrayBuffer(\n targetBuffer: ArrayBuffer,\n sourceBuffer: ArrayBuffer,\n byteOffset: number,\n byteLength: number = sourceBuffer.byteLength\n): ArrayBuffer {\n const targetArray = new Uint8Array(targetBuffer, byteOffset, byteLength);\n const sourceArray = new Uint8Array(sourceBuffer);\n targetArray.set(sourceArray);\n return targetBuffer;\n}\n\n/**\n * Copy from source to target at the targetOffset\n *\n * @param source - The data to copy\n * @param target - The destination to copy data into\n * @param targetOffset - The start offset into target to place the copied data\n * @returns the new offset taking into account proper padding\n */\nexport function copyToArray(source: ArrayBuffer | any, target: any, targetOffset: number): number {\n let sourceArray;\n\n if (source instanceof ArrayBuffer) {\n sourceArray = new Uint8Array(source);\n } else {\n // Pack buffer onto the big target array\n //\n // 'source.data.buffer' could be a view onto a larger buffer.\n // We MUST use this constructor to ensure the byteOffset and byteLength is\n // set to correct values from 'source.data' and not the underlying\n // buffer for target.set() to work properly.\n const srcByteOffset = source.byteOffset;\n const srcByteLength = source.byteLength;\n // In gltf parser it is set as \"arrayBuffer\" instead of \"buffer\"\n // https://github.com/visgl/loaders.gl/blob/1e3a82a0a65d7b6a67b1e60633453e5edda2960a/modules/gltf/src/lib/parse-gltf.js#L85\n sourceArray = new Uint8Array(source.buffer || source.arrayBuffer, srcByteOffset, srcByteLength);\n }\n\n // Pack buffer onto the big target array\n target.set(sourceArray, targetOffset);\n\n return targetOffset + padToNBytes(sourceArray.byteLength, 4);\n}\n"],"mappings":"SAAQA,MAAM;AASd,OAAO,SAASC,WAAWA,CAACC,UAAkB,EAAEC,OAAe,EAAU;EACvEH,MAAM,CAACE,UAAU,IAAI,CAAC,CAAC;EACvBF,MAAM,CAACG,OAAO,GAAG,CAAC,CAAC;EACnB,OAAQD,UAAU,IAAIC,OAAO,GAAG,CAAC,CAAC,GAAI,EAAEA,OAAO,GAAG,CAAC,CAAC;AACtD;AAQA,OAAO,SAASC,eAAeA,CAC7BC,YAAyB,EACzBC,YAAyB,EACzBC,UAAkB,EAEL;EAAA,IADbL,UAAkB,GAAAM,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAGF,YAAY,CAACJ,UAAU;EAE5C,MAAMS,WAAW,GAAG,IAAIC,UAAU,CAACP,YAAY,EAAEE,UAAU,EAAEL,UAAU,CAAC;EACxE,MAAMW,WAAW,GAAG,IAAID,UAAU,CAACN,YAAY,CAAC;EAChDK,WAAW,CAACG,GAAG,CAACD,WAAW,CAAC;EAC5B,OAAOR,YAAY;AACrB;AAUA,OAAO,SAASU,WAAWA,CAACC,MAAyB,EAAEC,MAAW,EAAEC,YAAoB,EAAU;EAChG,IAAIL,WAAW;EAEf,IAAIG,MAAM,YAAYG,WAAW,EAAE;IACjCN,WAAW,GAAG,IAAID,UAAU,CAACI,MAAM,CAAC;EACtC,CAAC,MAAM;IAOL,MAAMI,aAAa,GAAGJ,MAAM,CAACT,UAAU;IACvC,MAAMc,aAAa,GAAGL,MAAM,CAACd,UAAU;IAGvCW,WAAW,GAAG,IAAID,UAAU,CAACI,MAAM,CAACM,MAAM,IAAIN,MAAM,CAACO,WAAW,EAAEH,aAAa,EAAEC,aAAa,CAAC;EACjG;EAGAJ,MAAM,CAACH,GAAG,CAACD,WAAW,EAAEK,YAAY,CAAC;EAErC,OAAOA,YAAY,GAAGjB,WAAW,CAACY,WAAW,CAACX,UAAU,EAAE,CAAC,CAAC;AAC9D"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"assert.js","names":["assert","condition","message","Error"],"sources":["../../../src/lib/env-utils/assert.ts"],"sourcesContent":["/**\n * Throws an `Error` with the optional `message` if `condition` is falsy\n * @note Replacement for the external assert method to reduce bundle size\n */\nexport function assert(condition: any, message?: string): void {\n if (!condition) {\n throw new Error(message || 'loader assertion failed.');\n }\n}\n"],"mappings":"AAIA,OAAO,SAASA,MAAMA,CAACC,SAAc,EAAEC,OAAgB,EAAQ;EAC7D,IAAI,CAACD,SAAS,EAAE;IACd,MAAM,IAAIE,KAAK,CAACD,OAAO,IAAI,0BAA0B,CAAC;EACxD;AACF"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"globals.js","names":["globals","self","window","global","document","self_","window_","global_","document_","isBrowser","Boolean","process","String","browser","isWorker","importScripts","matches","version","exec","nodeVersion","parseFloat"],"sources":["../../../src/lib/env-utils/globals.ts"],"sourcesContent":["// Purpose: include this in your module to avoid\n// dependencies on micro modules like 'global' and 'is-browser';\n\n/* eslint-disable no-restricted-globals */\nconst globals = {\n self: typeof self !== 'undefined' && self,\n window: typeof window !== 'undefined' && window,\n global: typeof global !== 'undefined' && global,\n document: typeof document !== 'undefined' && document\n};\n\ntype obj = {[key: string]: any};\nconst self_: obj = globals.self || globals.window || globals.global || {};\nconst window_: obj = globals.window || globals.self || globals.global || {};\nconst global_: obj = globals.global || globals.self || globals.window || {};\nconst document_: obj = globals.document || {};\n\nexport {self_ as self, window_ as window, global_ as global, document_ as document};\n\n/** true if running in a browser */\nexport const isBrowser: boolean =\n // @ts-ignore process does not exist on browser\n Boolean(typeof process !== 'object' || String(process) !== '[object process]' || process.browser);\n\n/** true if running in a worker thread */\nexport const isWorker: boolean = typeof importScripts === 'function';\n\n// Extract node major version\nconst matches =\n typeof process !== 'undefined' && process.version && /v([0-9]*)/.exec(process.version);\n/** Major Node version (as a number) */\nexport const nodeVersion: number = (matches && parseFloat(matches[1])) || 0;\n"],"mappings":"AAIA,MAAMA,OAAO,GAAG;EACdC,IAAI,EAAE,OAAOA,IAAI,KAAK,WAAW,IAAIA,IAAI;EACzCC,MAAM,EAAE,OAAOA,MAAM,KAAK,WAAW,IAAIA,MAAM;EAC/CC,MAAM,EAAE,OAAOA,MAAM,KAAK,WAAW,IAAIA,MAAM;EAC/CC,QAAQ,EAAE,OAAOA,QAAQ,KAAK,WAAW,IAAIA;AAC/C,CAAC;AAGD,MAAMC,KAAU,GAAGL,OAAO,CAACC,IAAI,IAAID,OAAO,CAACE,MAAM,IAAIF,OAAO,CAACG,MAAM,IAAI,CAAC,CAAC;AACzE,MAAMG,OAAY,GAAGN,OAAO,CAACE,MAAM,IAAIF,OAAO,CAACC,IAAI,IAAID,OAAO,CAACG,MAAM,IAAI,CAAC,CAAC;AAC3E,MAAMI,OAAY,GAAGP,OAAO,CAACG,MAAM,IAAIH,OAAO,CAACC,IAAI,IAAID,OAAO,CAACE,MAAM,IAAI,CAAC,CAAC;AAC3E,MAAMM,SAAc,GAAGR,OAAO,CAACI,QAAQ,IAAI,CAAC,CAAC;AAE7C,SAAQC,KAAK,IAAIJ,IAAI,EAAEK,OAAO,IAAIJ,MAAM,EAAEK,OAAO,IAAIJ,MAAM,EAAEK,SAAS,IAAIJ,QAAQ;AAGlF,OAAO,MAAMK,SAAkB,GAE7BC,OAAO,CAAC,OAAOC,OAAO,KAAK,QAAQ,IAAIC,MAAM,CAACD,OAAO,CAAC,KAAK,kBAAkB,IAAIA,OAAO,CAACE,OAAO,CAAC;AAGnG,OAAO,MAAMC,QAAiB,GAAG,OAAOC,aAAa,KAAK,UAAU;AAGpE,MAAMC,OAAO,GACX,OAAOL,OAAO,KAAK,WAAW,IAAIA,OAAO,CAACM,OAAO,IAAI,WAAW,CAACC,IAAI,CAACP,OAAO,CAACM,OAAO,CAAC;AAExF,OAAO,MAAME,WAAmB,GAAIH,OAAO,IAAII,UAAU,CAACJ,OAAO,CAAC,CAAC,CAAC,CAAC,IAAK,CAAC"}
@@ -1,5 +1,8 @@
1
1
  import { FileProvider } from './file-provider';
2
- /** Provides file data using DataView */
2
+ /**
3
+ * Provides file data using DataView
4
+ * @deprecated - will be replaced with ReadableFile
5
+ */
3
6
  export declare class DataViewFile implements FileProvider {
4
7
  /** The DataView from which data is provided */
5
8
  private file;
@@ -1 +1 @@
1
- {"version":3,"file":"data-view-file.d.ts","sourceRoot":"","sources":["../../../src/lib/file-provider/data-view-file.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,YAAY,EAAC,MAAM,iBAAiB,CAAC;AAc7C,wCAAwC;AACxC,qBAAa,YAAa,YAAW,YAAY;IAC/C,+CAA+C;IAC/C,OAAO,CAAC,IAAI,CAAW;gBAEX,IAAI,EAAE,QAAQ;IAKpB,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IAE9B;;;OAGG;IACG,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAI/C;;;OAGG;IACG,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAIhD;;;OAGG;IACG,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAIhD;;;OAGG;IACG,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAInD;;;;OAIG;IACG,KAAK,CAAC,WAAW,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC;IAIzE,yCAAyC;IACzC,IAAI,MAAM,WAET;CACF"}
1
+ {"version":3,"file":"data-view-file.d.ts","sourceRoot":"","sources":["../../../src/lib/file-provider/data-view-file.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,YAAY,EAAC,MAAM,iBAAiB,CAAC;AAc7C;;;GAGG;AACH,qBAAa,YAAa,YAAW,YAAY;IAC/C,+CAA+C;IAC/C,OAAO,CAAC,IAAI,CAAW;gBAEX,IAAI,EAAE,QAAQ;IAIpB,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IAE9B;;;OAGG;IACG,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAI/C;;;OAGG;IACG,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAIhD;;;OAGG;IACG,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAIhD;;;OAGG;IACG,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAInD;;;;OAIG;IACG,KAAK,CAAC,WAAW,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC;IAIzE,yCAAyC;IACzC,IAAI,MAAM,WAET;CACF"}
@@ -1,4 +1,3 @@
1
- import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
2
1
  const toNumber = bigint => {
3
2
  if (bigint > Number.MAX_SAFE_INTEGER) {
4
3
  throw new Error('Offset is out of bounds');
@@ -7,7 +6,7 @@ const toNumber = bigint => {
7
6
  };
8
7
  export class DataViewFile {
9
8
  constructor(file) {
10
- _defineProperty(this, "file", void 0);
9
+ this.file = void 0;
11
10
  this.file = file;
12
11
  }
13
12
  async destroy() {}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"data-view-file.js","names":["toNumber","bigint","Number","MAX_SAFE_INTEGER","Error","DataViewFile","constructor","file","destroy","getUint8","offset","getUint16","getUint32","getBigUint64","slice","startOffset","endOffset","buffer","length","BigInt","byteLength"],"sources":["../../../src/lib/file-provider/data-view-file.ts"],"sourcesContent":["import {FileProvider} from './file-provider';\n\n/**\n * Checks if bigint can be converted to number and convert it if possible\n * @param bigint bigint to be converted\n * @returns number\n */\nconst toNumber = (bigint: bigint) => {\n if (bigint > Number.MAX_SAFE_INTEGER) {\n throw new Error('Offset is out of bounds');\n }\n return Number(bigint);\n};\n\n/**\n * Provides file data using DataView\n * @deprecated - will be replaced with ReadableFile\n */\nexport class DataViewFile implements FileProvider {\n /** The DataView from which data is provided */\n private file: DataView;\n\n constructor(file: DataView) {\n this.file = file;\n }\n\n async destroy(): Promise<void> {}\n\n /**\n * Gets an unsigned 8-bit integer at the specified byte offset from the start of the file.\n * @param offset The offset, in bytes, from the start of the file where to read the data.\n */\n async getUint8(offset: bigint): Promise<number> {\n return this.file.getUint8(toNumber(offset));\n }\n\n /**\n * Gets an unsigned 16-bit intege at the specified byte offset from the start of the file.\n * @param offset The offset, in bytes, from the start of the file where to read the data.\n */\n async getUint16(offset: bigint): Promise<number> {\n return this.file.getUint16(toNumber(offset), true);\n }\n\n /**\n * Gets an unsigned 32-bit integer at the specified byte offset from the start of the file.\n * @param offset The offset, in bytes, from the start of the file where to read the data.\n */\n async getUint32(offset: bigint): Promise<number> {\n return this.file.getUint32(toNumber(offset), true);\n }\n\n /**\n * Gets an unsigned 64-bit integer at the specified byte offset from the start of the file.\n * @param offset The offset, in bytes, from the start of the file where to read the data.\n */\n async getBigUint64(offset: bigint): Promise<bigint> {\n return this.file.getBigUint64(toNumber(offset), true);\n }\n\n /**\n * returns an ArrayBuffer whose contents are a copy of this file bytes from startOffset, inclusive, up to endOffset, exclusive.\n * @param startOffset The offset, in bytes, from the start of the file where to start reading the data.\n * @param endOffset The offset, in bytes, from the start of the file where to end reading the data.\n */\n async slice(startOffset: bigint, endOffset: bigint): Promise<ArrayBuffer> {\n return this.file.buffer.slice(toNumber(startOffset), toNumber(endOffset));\n }\n\n /** the length (in bytes) of the data. */\n get length() {\n return BigInt(this.file.byteLength);\n }\n}\n"],"mappings":"AAOA,MAAMA,QAAQ,GAAIC,MAAc,IAAK;EACnC,IAAIA,MAAM,GAAGC,MAAM,CAACC,gBAAgB,EAAE;IACpC,MAAM,IAAIC,KAAK,CAAC,yBAAyB,CAAC;EAC5C;EACA,OAAOF,MAAM,CAACD,MAAM,CAAC;AACvB,CAAC;AAMD,OAAO,MAAMI,YAAY,CAAyB;EAIhDC,WAAWA,CAACC,IAAc,EAAE;IAAA,KAFpBA,IAAI;IAGV,IAAI,CAACA,IAAI,GAAGA,IAAI;EAClB;EAEA,MAAMC,OAAOA,CAAA,EAAkB,CAAC;EAMhC,MAAMC,QAAQA,CAACC,MAAc,EAAmB;IAC9C,OAAO,IAAI,CAACH,IAAI,CAACE,QAAQ,CAACT,QAAQ,CAACU,MAAM,CAAC,CAAC;EAC7C;EAMA,MAAMC,SAASA,CAACD,MAAc,EAAmB;IAC/C,OAAO,IAAI,CAACH,IAAI,CAACI,SAAS,CAACX,QAAQ,CAACU,MAAM,CAAC,EAAE,IAAI,CAAC;EACpD;EAMA,MAAME,SAASA,CAACF,MAAc,EAAmB;IAC/C,OAAO,IAAI,CAACH,IAAI,CAACK,SAAS,CAACZ,QAAQ,CAACU,MAAM,CAAC,EAAE,IAAI,CAAC;EACpD;EAMA,MAAMG,YAAYA,CAACH,MAAc,EAAmB;IAClD,OAAO,IAAI,CAACH,IAAI,CAACM,YAAY,CAACb,QAAQ,CAACU,MAAM,CAAC,EAAE,IAAI,CAAC;EACvD;EAOA,MAAMI,KAAKA,CAACC,WAAmB,EAAEC,SAAiB,EAAwB;IACxE,OAAO,IAAI,CAACT,IAAI,CAACU,MAAM,CAACH,KAAK,CAACd,QAAQ,CAACe,WAAW,CAAC,EAAEf,QAAQ,CAACgB,SAAS,CAAC,CAAC;EAC3E;EAGA,IAAIE,MAAMA,CAAA,EAAG;IACX,OAAOC,MAAM,CAAC,IAAI,CAACZ,IAAI,CAACa,UAAU,CAAC;EACrC;AACF"}
@@ -1,50 +1,43 @@
1
1
  import { FileProvider } from './file-provider';
2
2
  /**
3
3
  * Provides file data using node fs library
4
+ * @deprecated - will be replaced with ReadableFile
4
5
  */
5
6
  export declare class FileHandleFile implements FileProvider {
6
- /**
7
- * Returns a new copy of FileHandleFile
8
- * @param path The path to the file in file system
9
- */
10
- static from(path: string): Promise<FileHandleFile>;
11
- /**
12
- * The FileHandle from which data is provided
13
- */
14
- private fileDescriptor;
15
- /**
16
- * The file length in bytes
17
- */
7
+ /** The FileHandle from which data is provided */
8
+ private file;
9
+ /** The file length in bytes */
18
10
  private size;
19
- private constructor();
11
+ /** Create a new FileHandleFile */
12
+ constructor(path: string);
20
13
  /** Close file */
21
14
  destroy(): Promise<void>;
22
15
  /**
23
16
  * Gets an unsigned 8-bit integer at the specified byte offset from the start of the file.
24
17
  * @param offset The offset, in bytes, from the start of the file where to read the data.
25
18
  */
26
- getUint8(offset: bigint): Promise<number>;
19
+ getUint8(offset: number | bigint): Promise<number>;
27
20
  /**
28
21
  * Gets an unsigned 16-bit integer at the specified byte offset from the start of the file.
29
22
  * @param offset The offset, in bytes, from the start of the file where to read the data.
30
23
  */
31
- getUint16(offset: bigint): Promise<number>;
24
+ getUint16(offset: number | bigint): Promise<number>;
32
25
  /**
33
26
  * Gets an unsigned 32-bit integer at the specified byte offset from the start of the file.
34
27
  * @param offset The offset, in bytes, from the start of the file where to read the data.
35
28
  */
36
- getUint32(offset: bigint): Promise<number>;
29
+ getUint32(offset: number | bigint): Promise<number>;
37
30
  /**
38
31
  * Gets an unsigned 32-bit integer at the specified byte offset from the start of the file.
39
32
  * @param offset The offset, in bytes, from the start of the file where to read the data.
40
33
  */
41
- getBigUint64(offset: bigint): Promise<bigint>;
34
+ getBigUint64(offset: number | bigint): Promise<bigint>;
42
35
  /**
43
36
  * returns an ArrayBuffer whose contents are a copy of this file bytes from startOffset, inclusive, up to endOffset, exclusive.
44
- * @param startOffsset The offset, in byte, from the start of the file where to start reading the data.
37
+ * @param startOffset The offset, in byte, from the start of the file where to start reading the data.
45
38
  * @param endOffset The offset, in bytes, from the start of the file where to end reading the data.
46
39
  */
47
- slice(startOffsset: bigint, endOffset: bigint): Promise<ArrayBuffer>;
40
+ slice(startOffset: bigint, endOffset: bigint): Promise<ArrayBuffer>;
48
41
  /**
49
42
  * the length (in bytes) of the data.
50
43
  */
@@ -1 +1 @@
1
- {"version":3,"file":"file-handle-file.d.ts","sourceRoot":"","sources":["../../../src/lib/file-provider/file-handle-file.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,YAAY,EAAC,MAAM,iBAAiB,CAAC;AAI7C;;GAEG;AACH,qBAAa,cAAe,YAAW,YAAY;IACjD;;;OAGG;WACU,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC;IAMxD;;OAEG;IACH,OAAO,CAAC,cAAc,CAAa;IAEnC;;OAEG;IACH,OAAO,CAAC,IAAI,CAAS;IAErB,OAAO;IAKP,iBAAiB;IACX,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IAI9B;;;OAGG;IACG,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAU/C;;;OAGG;IACG,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAUhD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+1,56 @@
1
+ import { NodeFileFacade as NodeFile } from "../files/node-file-facade.js";
2
+ export class FileHandleFile {
3
+ constructor(path) {
4
+ this.file = void 0;
5
+ this.size = void 0;
6
+ this.file = new NodeFile(path, 'r');
7
+ this.size = this.file.bigsize;
8
+ }
9
+ async destroy() {
10
+ await this.file.close();
11
+ }
12
+ async getUint8(offset) {
13
+ const arrayBuffer = await this.file.read(offset, 1);
14
+ const val = new Uint8Array(arrayBuffer).at(0);
15
+ if (val === undefined) {
16
+ throw new Error('something went wrong');
17
+ }
18
+ return val;
19
+ }
20
+ async getUint16(offset) {
21
+ const arrayBuffer = await this.file.read(offset, 2);
22
+ const val = new Uint16Array(arrayBuffer).at(0);
23
+ if (val === undefined) {
24
+ throw new Error('something went wrong');
25
+ }
26
+ return val;
27
+ }
28
+ async getUint32(offset) {
29
+ const arrayBuffer = await this.file.read(offset, 4);
30
+ const val = new Uint32Array(arrayBuffer).at(0);
31
+ if (val === undefined) {
32
+ throw new Error('something went wrong');
33
+ }
34
+ return val;
35
+ }
36
+ async getBigUint64(offset) {
37
+ const arrayBuffer = await this.file.read(offset, 8);
38
+ const val = new BigInt64Array(arrayBuffer).at(0);
39
+ if (val === undefined) {
40
+ throw new Error('something went wrong');
41
+ }
42
+ return val;
43
+ }
44
+ async slice(startOffset, endOffset) {
45
+ const bigLength = endOffset - startOffset;
46
+ if (bigLength > Number.MAX_SAFE_INTEGER) {
47
+ throw new Error('too big slice');
48
+ }
49
+ const length = Number(bigLength);
50
+ return await this.file.read(startOffset, length);
51
+ }
52
+ get length() {
53
+ return this.size;
54
+ }
55
+ }
56
+ //# sourceMappingURL=file-handle-file.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"file-handle-file.js","names":["NodeFileFacade","NodeFile","FileHandleFile","constructor","path","file","size","bigsize","destroy","close","getUint8","offset","arrayBuffer","read","val","Uint8Array","at","undefined","Error","getUint16","Uint16Array","getUint32","Uint32Array","getBigUint64","BigInt64Array","slice","startOffset","endOffset","bigLength","Number","MAX_SAFE_INTEGER","length"],"sources":["../../../src/lib/file-provider/file-handle-file.ts"],"sourcesContent":["// loaders.gl, MIT license\n\nimport {FileProvider} from './file-provider';\nimport {NodeFileFacade as NodeFile} from '../files/node-file-facade';\n\n/**\n * Provides file data using node fs library\n * @deprecated - will be replaced with ReadableFile\n */\nexport class FileHandleFile implements FileProvider {\n /** The FileHandle from which data is provided */\n private file: NodeFile;\n\n /** The file length in bytes */\n private size: bigint;\n\n /** Create a new FileHandleFile */\n constructor(path: string) {\n this.file = new NodeFile(path, 'r');\n this.size = this.file.bigsize;\n }\n\n /** Close file */\n async destroy(): Promise<void> {\n await this.file.close();\n }\n\n /**\n * Gets an unsigned 8-bit integer at the specified byte offset from the start of the file.\n * @param offset The offset, in bytes, from the start of the file where to read the data.\n */\n async getUint8(offset: number | bigint): Promise<number> {\n const arrayBuffer = await this.file.read(offset, 1);\n const val = new Uint8Array(arrayBuffer).at(0);\n if (val === undefined) {\n throw new Error('something went wrong');\n }\n return val;\n }\n\n /**\n * Gets an unsigned 16-bit integer at the specified byte offset from the start of the file.\n * @param offset The offset, in bytes, from the start of the file where to read the data.\n */\n async getUint16(offset: number | bigint): Promise<number> {\n const arrayBuffer = await this.file.read(offset, 2);\n const val = new Uint16Array(arrayBuffer).at(0);\n if (val === undefined) {\n throw new Error('something went wrong');\n }\n return val;\n }\n\n /**\n * Gets an unsigned 32-bit integer at the specified byte offset from the start of the file.\n * @param offset The offset, in bytes, from the start of the file where to read the data.\n */\n async getUint32(offset: number | bigint): Promise<number> {\n const arrayBuffer = await this.file.read(offset, 4);\n const val = new Uint32Array(arrayBuffer).at(0);\n if (val === undefined) {\n throw new Error('something went wrong');\n }\n return val;\n }\n\n /**\n * Gets an unsigned 32-bit integer at the specified byte offset from the start of the file.\n * @param offset The offset, in bytes, from the start of the file where to read the data.\n */\n async getBigUint64(offset: number | bigint): Promise<bigint> {\n const arrayBuffer = await this.file.read(offset, 8);\n const val = new BigInt64Array(arrayBuffer).at(0);\n if (val === undefined) {\n throw new Error('something went wrong');\n }\n return val;\n }\n\n /**\n * returns an ArrayBuffer whose contents are a copy of this file bytes from startOffset, inclusive, up to endOffset, exclusive.\n * @param startOffset The offset, in byte, from the start of the file where to start reading the data.\n * @param endOffset The offset, in bytes, from the start of the file where to end reading the data.\n */\n async slice(startOffset: bigint, endOffset: bigint): Promise<ArrayBuffer> {\n const bigLength = endOffset - startOffset;\n if (bigLength > Number.MAX_SAFE_INTEGER) {\n throw new Error('too big slice');\n }\n const length = Number(bigLength);\n return await this.file.read(startOffset, length);\n }\n\n /**\n * the length (in bytes) of the data.\n */\n get length(): bigint {\n return this.size;\n }\n}\n"],"mappings":"SAGQA,cAAc,IAAIC,QAAQ;AAMlC,OAAO,MAAMC,cAAc,CAAyB;EAQlDC,WAAWA,CAACC,IAAY,EAAE;IAAA,KANlBC,IAAI;IAAA,KAGJC,IAAI;IAIV,IAAI,CAACD,IAAI,GAAG,IAAIJ,QAAQ,CAACG,IAAI,EAAE,GAAG,CAAC;IACnC,IAAI,CAACE,IAAI,GAAG,IAAI,CAACD,IAAI,CAACE,OAAO;EAC/B;EAGA,MAAMC,OAAOA,CAAA,EAAkB;IAC7B,MAAM,IAAI,CAACH,IAAI,CAACI,KAAK,CAAC,CAAC;EACzB;EAMA,MAAMC,QAAQA,CAACC,MAAuB,EAAmB;IACvD,MAAMC,WAAW,GAAG,MAAM,IAAI,CAACP,IAAI,CAACQ,IAAI,CAACF,MAAM,EAAE,CAAC,CAAC;IACnD,MAAMG,GAAG,GAAG,IAAIC,UAAU,CAACH,WAAW,CAAC,CAACI,EAAE,CAAC,CAAC,CAAC;IAC7C,IAAIF,GAAG,KAAKG,SAAS,EAAE;MACrB,MAAM,IAAIC,KAAK,CAAC,sBAAsB,CAAC;IACzC;IACA,OAAOJ,GAAG;EACZ;EAMA,MAAMK,SAASA,CAACR,MAAuB,EAAmB;IACxD,MAAMC,WAAW,GAAG,MAAM,IAAI,CAACP,IAAI,CAACQ,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EAAEK,MAAM,CAAC;EAClD;EAKA,IAAIA,MAAMA,CAAA,EAAW;IACnB,OAAO,IAAI,CAACzB,IAAI;EAClB;AACF"}
@@ -1,5 +1,6 @@
1
1
  /**
2
2
  * Interface for providing file data
3
+ * @deprecated - will be replaced with ReadableFile
3
4
  */
4
5
  export interface FileProvider {
5
6
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"file-provider.d.ts","sourceRoot":"","sources":["../../../src/lib/file-provider/file-provider.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B;;OAEG;IACH,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IACzB;;;OAGG;IACH,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAE1C;;;OAGG;IACH,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAE3C;;;OAGG;IACH,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAE3C;;;OAGG;IACH,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAE9C;;;;OAIG;IACH,KAAK,CAAC,WAAW,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC;IAEpE;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;CAChB;AAED;;;GAGG;AACH,eAAO,MAAM,cAAc,iBAAkB,OAAO,WAMnD,CAAC"}
1
+ {"version":3,"file":"file-provider.d.ts","sourceRoot":"","sources":["../../../src/lib/file-provider/file-provider.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,WAAW,YAAY;IAC3B;;OAEG;IACH,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IACzB;;;OAGG;IACH,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAE1C;;;OAGG;IACH,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAE3C;;;OAGG;IACH,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAE3C;;;OAGG;IACH,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAE9C;;;;OAIG;IACH,KAAK,CAAC,WAAW,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC;IAEpE;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;CAChB;AAED;;;GAGG;AACH,eAAO,MAAM,cAAc,iBAAkB,OAAO,WAMnD,CAAC"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"file-provider.js","names":["isFileProvider","fileProvider","getUint8","slice","length"],"sources":["../../../src/lib/file-provider/file-provider.ts"],"sourcesContent":["/**\n * Interface for providing file data\n * @deprecated - will be replaced with ReadableFile\n */\nexport interface FileProvider {\n /**\n * Cleanup class data\n */\n destroy(): Promise<void>;\n /**\n * Gets an unsigned 8-bit integer at the specified byte offset from the start of the file.\n * @param offset The offset, in bytes, from the start of the file where to read the data.\n */\n getUint8(offset: bigint): Promise<number>;\n\n /**\n * Gets an unsigned 16-bit integer at the specified byte offset from the start of the file.\n * @param offset The offset, in bytes, from the start of the file where to read the data.\n */\n getUint16(offset: bigint): Promise<number>;\n\n /**\n * Gets an unsigned 32-bit integer at the specified byte offset from the start of the file.\n * @param offset The offset, in bytes, from the file of the view where to read the data.\n */\n getUint32(offset: bigint): Promise<number>;\n\n /**\n * Gets an unsigned 32-bit integer at the specified byte offset from the start of the file.\n * @param offset The offset, in byte, from the file of the view where to read the data.\n */\n getBigUint64(offset: bigint): Promise<bigint>;\n\n /**\n * returns an ArrayBuffer whose contents are a copy of this file bytes from startOffset, inclusive, up to endOffset, exclusive.\n * @param startOffset The offset, in bytes, from the start of the file where to start reading the data.\n * @param endOffset The offset, in bytes, from the start of the file where to end reading the data.\n */\n slice(startOffset: bigint, endOffset: bigint): Promise<ArrayBuffer>;\n\n /**\n * the length (in bytes) of the data.\n */\n length: bigint;\n}\n\n/**\n * Check is the object has FileProvider members\n * @param fileProvider - tested object\n */\nexport const isFileProvider = (fileProvider: unknown) => {\n return (\n (fileProvider as FileProvider)?.getUint8 &&\n (fileProvider as FileProvider)?.slice &&\n (fileProvider as FileProvider)?.length\n );\n};\n"],"mappings":"AAkDA,OAAO,MAAMA,cAAc,GAAIC,YAAqB,IAAK;EACvD,OACE,CAACA,YAAY,aAAZA,YAAY,uBAAZA,YAAY,CAAmBC,QAAQ,MACvCD,YAAY,aAAZA,YAAY,uBAAZA,YAAY,CAAmBE,KAAK,MACpCF,YAAY,aAAZA,YAAY,uBAAZA,YAAY,CAAmBG,MAAM;AAE1C,CAAC"}
@@ -0,0 +1,16 @@
1
+ import { ReadableFile } from './file';
2
+ export declare class BlobFile implements ReadableFile {
3
+ readonly handle: Blob;
4
+ readonly size: number;
5
+ readonly bigsize: bigint;
6
+ readonly url: string;
7
+ constructor(blob: Blob | File | ArrayBuffer);
8
+ close(): Promise<void>;
9
+ stat(): Promise<{
10
+ size: number;
11
+ bigsize: bigint;
12
+ isDirectory: boolean;
13
+ }>;
14
+ read(start: number, length: number): Promise<ArrayBuffer>;
15
+ }
16
+ //# sourceMappingURL=blob-file.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"blob-file.d.ts","sourceRoot":"","sources":["../../../src/lib/files/blob-file.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,YAAY,EAAC,MAAM,QAAQ,CAAC;AAEpC,qBAAa,QAAS,YAAW,YAAY;IAC3C,QAAQ,CAAC,MAAM,EAAE,IAAI,CAAC;IACtB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;gBAET,IAAI,EAAE,IAAI,GAAG,IAAI,GAAG,WAAW;IAOrC,KAAK;IAEL,IAAI;;;;;IAQJ,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC;CAIhE"}
@@ -0,0 +1,25 @@
1
+ export class BlobFile {
2
+ constructor(blob) {
3
+ this.handle = void 0;
4
+ this.size = void 0;
5
+ this.bigsize = void 0;
6
+ this.url = void 0;
7
+ this.handle = blob instanceof ArrayBuffer ? new Blob([blob]) : blob;
8
+ this.size = blob instanceof ArrayBuffer ? blob.byteLength : blob.size;
9
+ this.bigsize = BigInt(this.size);
10
+ this.url = blob instanceof File ? blob.name : '';
11
+ }
12
+ async close() {}
13
+ async stat() {
14
+ return {
15
+ size: this.handle.size,
16
+ bigsize: BigInt(this.handle.size),
17
+ isDirectory: false
18
+ };
19
+ }
20
+ async read(start, length) {
21
+ const arrayBuffer = await this.handle.slice(start, start + length).arrayBuffer();
22
+ return arrayBuffer;
23
+ }
24
+ }
25
+ //# sourceMappingURL=blob-file.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"blob-file.js","names":["BlobFile","constructor","blob","handle","size","bigsize","url","ArrayBuffer","Blob","byteLength","BigInt","File","name","close","stat","isDirectory","read","start","length","arrayBuffer","slice"],"sources":["../../../src/lib/files/blob-file.ts"],"sourcesContent":["// loaders.gl, MIT license\n\nimport {ReadableFile} from './file';\n\nexport class BlobFile implements ReadableFile {\n readonly handle: Blob;\n readonly size: number;\n readonly bigsize: bigint;\n readonly url: string;\n\n constructor(blob: Blob | File | ArrayBuffer) {\n this.handle = blob instanceof ArrayBuffer ? new Blob([blob]) : blob;\n this.size = blob instanceof ArrayBuffer ? blob.byteLength : blob.size;\n this.bigsize = BigInt(this.size);\n this.url = blob instanceof File ? blob.name : '';\n }\n\n async close() {}\n\n async stat() {\n return {\n size: this.handle.size,\n bigsize: BigInt(this.handle.size),\n isDirectory: false\n };\n }\n\n async read(start: number, length: number): Promise<ArrayBuffer> {\n const arrayBuffer = await this.handle.slice(start, start + length).arrayBuffer();\n return arrayBuffer;\n }\n}\n"],"mappings":"AAIA,OAAO,MAAMA,QAAQ,CAAyB;EAM5CC,WAAWA,CAACC,IAA+B,EAAE;IAAA,KALpCC,MAAM;IAAA,KACNC,IAAI;IAAA,KACJC,OAAO;IAAA,KACPC,GAAG;IAGV,IAAI,CAACH,MAAM,GAAGD,IAAI,YAAYK,WAAW,GAAG,IAAIC,IAAI,CAAC,CAACN,IAAI,CAAC,CAAC,GAAGA,IAAI;IACnE,IAAI,CAACE,IAAI,GAAGF,IAAI,YAAYK,WAAW,GAAGL,IAAI,CAACO,UAAU,GAAGP,IAAI,CAACE,IAAI;IACrE,IAAI,CAACC,OAAO,GAAGK,MAAM,CAAC,IAAI,CAACN,IAAI,CAAC;IAChC,IAAI,CAACE,GAAG,GAAGJ,IAAI,YAAYS,IAAI,GAAGT,IAAI,CAACU,IAAI,GAAG,EAAE;EAClD;EAEA,MAAMC,KAAKA,CAAA,EAAG,CAAC;EAEf,MAAMC,IAAIA,CAAA,EAAG;IACX,OAAO;MACLV,IAAI,EAAE,IAAI,CAACD,MAAM,CAACC,IAAI;MACtBC,OAAO,EAAEK,MAAM,CAAC,IAAI,CAACP,MAAM,CAACC,IAAI,CAAC;MACjCW,WAAW,EAAE;IACf,CAAC;EACH;EAEA,MAAMC,IAAIA,CAACC,KAAa,EAAEC,MAAc,EAAwB;IAC9D,MAAMC,WAAW,GAAG,MAAM,IAAI,CAAChB,MAAM,CAACiB,KAAK,CAACH,KAAK,EAAEA,KAAK,GAAGC,MAAM,CAAC,CAACC,WAAW,CAAC,CAAC;IAChF,OAAOA,WAAW;EACpB;AACF"}
@@ -0,0 +1,33 @@
1
+ export type Stat = {
2
+ size: number;
3
+ bigsize: bigint;
4
+ isDirectory: boolean;
5
+ };
6
+ export interface ReadableFile {
7
+ /** The underlying file handle (Blob, Node.js file descriptor etc) */
8
+ readonly handle: unknown;
9
+ /** Length of file in bytes, if available */
10
+ readonly size: number;
11
+ /** Length of file in bytes, if available */
12
+ readonly bigsize: bigint;
13
+ /** Url, if available */
14
+ readonly url: string;
15
+ /** Read data */
16
+ read(start?: number | bigint, length?: number): Promise<ArrayBuffer>;
17
+ /** Read data */
18
+ fetchRange?(offset: number | bigint, length: number, signal?: AbortSignal): Promise<Response>;
19
+ /** Get information about file */
20
+ stat?(): Promise<Stat>;
21
+ /** Close the file */
22
+ close(): Promise<void>;
23
+ }
24
+ export interface WritableFile {
25
+ handle: unknown;
26
+ /** Write to file. The number of bytes written will be returned */
27
+ write: (arrayBuffer: ArrayBuffer, offset?: number | bigint, length?: number) => Promise<number>;
28
+ /** Get information about the file */
29
+ stat?(): Promise<Stat>;
30
+ /** Close the file */
31
+ close(): Promise<void>;
32
+ }
33
+ //# sourceMappingURL=file.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"file.d.ts","sourceRoot":"","sources":["../../../src/lib/files/file.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,IAAI,GAAG;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,OAAO,CAAC;CACtB,CAAC;AAEF,MAAM,WAAW,YAAY;IAC3B,qEAAqE;IACrE,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;IACzB,4CAA4C;IAC5C,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,4CAA4C;IAC5C,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,wBAAwB;IACxB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IAErB,gBAAgB;IAChB,IAAI,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC;IACrE,gBAAgB;IAChB,UAAU,CAAC,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;IAC9F,iCAAiC;IACjC,IAAI,CAAC,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IACvB,qBAAqB;IACrB,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CACxB;AAED,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,OAAO,CAAC;IAChB,kEAAkE;IAClE,KAAK,EAAE,CAAC,WAAW,EAAE,WAAW,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;IAChG,qCAAqC;IACrC,IAAI,CAAC,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IACvB,qBAAqB;IACrB,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CACxB"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=file.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"file.js","names":[],"sources":["../../../src/lib/files/file.ts"],"sourcesContent":["// loaders.gl, MIT license\n\nexport type Stat = {\n size: number;\n bigsize: bigint;\n isDirectory: boolean;\n};\n\nexport interface ReadableFile {\n /** The underlying file handle (Blob, Node.js file descriptor etc) */\n readonly handle: unknown;\n /** Length of file in bytes, if available */\n readonly size: number;\n /** Length of file in bytes, if available */\n readonly bigsize: bigint;\n /** Url, if available */\n readonly url: string;\n\n /** Read data */\n read(start?: number | bigint, length?: number): Promise<ArrayBuffer>;\n /** Read data */\n fetchRange?(offset: number | bigint, length: number, signal?: AbortSignal): Promise<Response>;\n /** Get information about file */\n stat?(): Promise<Stat>;\n /** Close the file */\n close(): Promise<void>;\n}\n\nexport interface WritableFile {\n handle: unknown;\n /** Write to file. The number of bytes written will be returned */\n write: (arrayBuffer: ArrayBuffer, offset?: number | bigint, length?: number) => Promise<number>;\n /** Get information about the file */\n stat?(): Promise<Stat>;\n /** Close the file */\n close(): Promise<void>;\n}\n"],"mappings":""}
@@ -0,0 +1,21 @@
1
+ import { ReadableFile, Stat } from './file';
2
+ export declare class HttpFile implements ReadableFile {
3
+ readonly handle: string;
4
+ readonly size: number;
5
+ readonly bigsize: bigint;
6
+ readonly url: string;
7
+ constructor(url: string);
8
+ close(): Promise<void>;
9
+ stat(): Promise<Stat>;
10
+ read(offset: number | bigint, length: number): Promise<ArrayBuffer>;
11
+ /**
12
+ *
13
+ * @param offset
14
+ * @param length
15
+ * @param signal
16
+ * @returns
17
+ * @see https://github.com/protomaps/PMTiles
18
+ */
19
+ fetchRange(offset: number | bigint, length: number, signal?: AbortSignal): Promise<Response>;
20
+ }
21
+ //# sourceMappingURL=http-file.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"http-file.d.ts","sourceRoot":"","sources":["../../../src/lib/files/http-file.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,YAAY,EAAE,IAAI,EAAC,MAAM,QAAQ,CAAC;AAE1C,qBAAa,QAAS,YAAW,YAAY;IAC3C,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAK;IAC1B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAM;IAC9B,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;gBAET,GAAG,EAAE,MAAM;IAKjB,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAEtB,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAarB,IAAI,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC;IAMzE;;;;;;;OAOG;IAEG,UAAU,CACd,MAAM,EAAE,MAAM,GAAG,MAAM,EACvB,MAAM,EAAE,MAAM,EACd,MAAM,CAAC,EAAE,WAAW,GACnB,OAAO,CAAC,QAAQ,CAAC;CAsErB"}