node-opcua-file-transfer 2.98.0 → 2.98.2

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.
@@ -0,0 +1,563 @@
1
+ "use strict";
2
+ /**
3
+ * @module node-opcua-file-transfer
4
+ */
5
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
6
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
7
+ return new (P || (P = Promise))(function (resolve, reject) {
8
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
9
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
10
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
11
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
12
+ });
13
+ };
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.installFileType = exports.defaultMaxSize = exports.getFileData = exports.writeFile = exports.FileTypeData = void 0;
16
+ const util_1 = require("util");
17
+ const fsOrig = require("fs");
18
+ const node_opcua_assert_1 = require("node-opcua-assert");
19
+ const node_opcua_address_space_base_1 = require("node-opcua-address-space-base");
20
+ const node_opcua_binary_stream_1 = require("node-opcua-binary-stream");
21
+ const node_opcua_debug_1 = require("node-opcua-debug");
22
+ const node_opcua_nodeid_1 = require("node-opcua-nodeid");
23
+ const node_opcua_status_code_1 = require("node-opcua-status-code");
24
+ const node_opcua_variant_1 = require("node-opcua-variant");
25
+ const open_mode_1 = require("../open_mode");
26
+ const debugLog = (0, node_opcua_debug_1.make_debugLog)("FileType");
27
+ const errorLog = (0, node_opcua_debug_1.make_errorLog)("FileType");
28
+ const warningLog = (0, node_opcua_debug_1.make_warningLog)("FileType");
29
+ const doDebug = (0, node_opcua_debug_1.checkDebugFlag)("FileType");
30
+ /**
31
+ *
32
+ */
33
+ class FileTypeData {
34
+ constructor(options, file) {
35
+ this.filename = "";
36
+ this.maxSize = 0;
37
+ this.mimeType = "";
38
+ this.maxChunkSizeBytes = 0;
39
+ this._openCount = 0;
40
+ this._fileSize = 0;
41
+ this.file = file;
42
+ this._fs = options.fileSystem || fsOrig;
43
+ this.refreshFileContentFunc = options.refreshFileContentFunc;
44
+ this.filename = options.filename;
45
+ this.maxSize = options.maxSize;
46
+ this.mimeType = options.mimeType || "";
47
+ this.maxChunkSizeBytes = options.maxChunkSize || FileTypeData.maxChunkSize;
48
+ // openCount indicates the number of currently valid file handles on the file.
49
+ this._openCount = 0;
50
+ file.openCount.bindVariable({
51
+ get: () => new node_opcua_variant_1.Variant({ dataType: node_opcua_variant_1.DataType.UInt16, value: this._openCount })
52
+ }, true);
53
+ file.openCount.minimumSamplingInterval = 0; // changes immediately
54
+ file.size.bindVariable({
55
+ get: () => new node_opcua_variant_1.Variant({ dataType: node_opcua_variant_1.DataType.UInt64, value: this._fileSize })
56
+ }, true);
57
+ file.size.minimumSamplingInterval = 0; // changes immediately
58
+ this.refresh();
59
+ }
60
+ set openCount(value) {
61
+ this._openCount = value;
62
+ this.file.openCount.touchValue();
63
+ }
64
+ get openCount() {
65
+ return this._openCount;
66
+ }
67
+ set fileSize(value) {
68
+ this._fileSize = value;
69
+ this.file.size.touchValue();
70
+ }
71
+ get fileSize() {
72
+ return this._fileSize;
73
+ }
74
+ /**
75
+ * refresh position and size
76
+ * this method should be call by the server if the file
77
+ * is modified externally
78
+ *
79
+ */
80
+ refresh() {
81
+ return __awaiter(this, void 0, void 0, function* () {
82
+ const abstractFs = this._fs;
83
+ // lauch an async request to update filesize
84
+ yield (function extractFileSize(self) {
85
+ return __awaiter(this, void 0, void 0, function* () {
86
+ try {
87
+ if (!abstractFs.existsSync(self.filename)) {
88
+ self._fileSize = 0;
89
+ return;
90
+ }
91
+ const stat = yield (0, util_1.promisify)(abstractFs.stat)(self.filename);
92
+ self._fileSize = stat.size;
93
+ debugLog("original file size ", self.filename, " size = ", self._fileSize);
94
+ }
95
+ catch (err) {
96
+ self._fileSize = 0;
97
+ if (err instanceof Error) {
98
+ warningLog("Cannot access file ", self.filename, err.message);
99
+ }
100
+ }
101
+ });
102
+ })(this);
103
+ });
104
+ }
105
+ refreshFileContent() {
106
+ return __awaiter(this, void 0, void 0, function* () {
107
+ if (this.refreshFileContentFunc) {
108
+ yield this.refreshFileContentFunc();
109
+ yield this.refresh();
110
+ }
111
+ });
112
+ }
113
+ }
114
+ FileTypeData.maxChunkSize = 16 * 1024 * 1024; // 16 MB
115
+ exports.FileTypeData = FileTypeData;
116
+ function writeFile(fileSystem, filename, content) {
117
+ return __awaiter(this, void 0, void 0, function* () {
118
+ yield new Promise((resolve, reject) => {
119
+ fileSystem.open(filename, "w", (err, fd) => {
120
+ // istanbul ignore next
121
+ if (err) {
122
+ return reject(err);
123
+ }
124
+ fileSystem.write(fd, content, 0, content.length, 0, (err) => {
125
+ // istanbul ignore next
126
+ if (err) {
127
+ return reject(err);
128
+ }
129
+ fileSystem.close(fd, (err) => {
130
+ // istanbul ignore next
131
+ if (err) {
132
+ return reject(err);
133
+ }
134
+ resolve();
135
+ });
136
+ });
137
+ });
138
+ });
139
+ });
140
+ }
141
+ exports.writeFile = writeFile;
142
+ /**
143
+ * @orivate
144
+ */
145
+ function getFileData(opcuaFile2) {
146
+ return opcuaFile2.$fileData;
147
+ }
148
+ exports.getFileData = getFileData;
149
+ function getFileDataFromContext(context) {
150
+ return getFileData(context.object);
151
+ }
152
+ function _prepare(addressSpace, context) {
153
+ const _context = addressSpace;
154
+ _context.$$currentFileHandle = _context.$$currentFileHandle ? _context.$$currentFileHandle : 41;
155
+ _context.$$files = _context.$$files || {};
156
+ return _context;
157
+ }
158
+ function _getSessionId(context) {
159
+ var _a;
160
+ if (!context.session) {
161
+ return new node_opcua_nodeid_1.NodeId();
162
+ }
163
+ (0, node_opcua_assert_1.assert)(context.session && context.session.getSessionId);
164
+ return ((_a = context.session) === null || _a === void 0 ? void 0 : _a.getSessionId()) || new node_opcua_nodeid_1.NodeId();
165
+ }
166
+ function _addFile(addressSpace, context, openMode) {
167
+ const _context = _prepare(addressSpace, context);
168
+ _context.$$currentFileHandle++;
169
+ const fileHandle = _context.$$currentFileHandle;
170
+ const sessionId = _getSessionId(context);
171
+ const _fileData = {
172
+ fd: -1,
173
+ handle: fileHandle,
174
+ openMode,
175
+ position: [0, 0],
176
+ size: 0,
177
+ sessionId
178
+ };
179
+ _context.$$files[fileHandle] = _fileData;
180
+ return fileHandle;
181
+ }
182
+ function _getFileInfo(addressSpace, context, fileHandle) {
183
+ const _context = _prepare(addressSpace, context);
184
+ const _fileInfo = _context.$$files[fileHandle];
185
+ const sessionId = _getSessionId(context);
186
+ if (!_fileInfo || !(0, node_opcua_nodeid_1.sameNodeId)(_fileInfo.sessionId, sessionId)) {
187
+ errorLog("Invalid session ID this file descriptor doesn't belong to this session");
188
+ return null;
189
+ }
190
+ return _fileInfo;
191
+ }
192
+ function _close(addressSpace, context, fileData) {
193
+ const _context = _prepare(addressSpace, context);
194
+ delete _context.$$files[fileData.fd];
195
+ }
196
+ function toNodeJSMode(opcuaMode) {
197
+ let flags;
198
+ switch (opcuaMode) {
199
+ case open_mode_1.OpenFileMode.Read:
200
+ flags = "r";
201
+ break;
202
+ case open_mode_1.OpenFileMode.ReadWrite:
203
+ case open_mode_1.OpenFileMode.Write:
204
+ flags = "w+";
205
+ break;
206
+ case open_mode_1.OpenFileMode.ReadWriteAppend:
207
+ case open_mode_1.OpenFileMode.WriteAppend:
208
+ flags = "a+";
209
+ break;
210
+ case open_mode_1.OpenFileMode.WriteEraseExisting:
211
+ case open_mode_1.OpenFileMode.ReadWriteEraseExisting:
212
+ flags = "w+";
213
+ break;
214
+ default:
215
+ flags = "?";
216
+ break;
217
+ }
218
+ return flags;
219
+ }
220
+ /**
221
+ * Open is used to open a file represented by an Object of FileType.
222
+ * When a client opens a file it gets a file handle that is valid while the
223
+ * session is open. Clients shall use the Close Method to release the handle
224
+ * when they do not need access to the file anymore. Clients can open the
225
+ * same file several times for read.
226
+ * A request to open for writing shall return Bad_NotWritable when the file is
227
+ * already opened.
228
+ * A request to open for reading shall return Bad_NotReadable
229
+ * when the file is already opened for writing.
230
+ *
231
+ * Method Result Codes (defined in Call Service)
232
+ * Result Code Description
233
+ * BadNotReadable File might be locked and thus not readable.
234
+ * BadNotWritable The file is locked and thus not writable.
235
+ * BadInvalidState
236
+ * BadInvalidArgument Mode setting is invalid.
237
+ * BadNotFound .
238
+ * BadUnexpectedError
239
+ *
240
+ * @private
241
+ */
242
+ function _openFile(inputArguments, context) {
243
+ return __awaiter(this, void 0, void 0, function* () {
244
+ const addressSpace = this.addressSpace;
245
+ const mode = inputArguments[0].value;
246
+ /**
247
+ * mode (Byte) Indicates whether the file should be opened only for read operations
248
+ * or for read and write operations and where the initial position is set.
249
+ * The mode is an 8-bit unsigned integer used as bit mask with the structure
250
+ * defined in the following table:
251
+ * Field Bit Description
252
+ * Read 0 The file is opened for reading. If this bit is not
253
+ * set the Read Method cannot be executed.
254
+ * Write 1 The file is opened for writing. If this bit is not
255
+ * set the Write Method cannot be executed.
256
+ * EraseExisting 2 This bit can only be set if the file is opened for writing
257
+ * (Write bit is set). The existing content of the file is
258
+ * erased and an empty file is provided.
259
+ * Append 3 When the Append bit is set the file is opened at end
260
+ * of the file, otherwise at begin of the file.
261
+ * The SetPosition Method can be used to change the position.
262
+ * Reserved 4:7 Reserved for future use. Shall always be zero.
263
+ */
264
+ // see https://nodejs.org/api/fs.html#fs_file_system_flags
265
+ const flags = toNodeJSMode(mode);
266
+ if (flags === "?") {
267
+ errorLog("Invalid mode " + open_mode_1.OpenFileMode[mode] + " (" + mode + ")");
268
+ return { statusCode: node_opcua_status_code_1.StatusCodes.BadInvalidArgument };
269
+ }
270
+ /**
271
+ * fileHandle (UInt32) A handle for the file used in other method calls indicating not the
272
+ * file (this is done by the Object of the Method call) but the access
273
+ * request and thus the position in the file. The fileHandle is generated
274
+ * by the server and is unique for the Session. Clients cannot transfer the
275
+ * fileHandle to another Session but need to get a new fileHandle by calling
276
+ * the Open Method.
277
+ */
278
+ const fileHandle = _addFile(addressSpace, context, mode);
279
+ const _fileInfo = _getFileInfo(addressSpace, context, fileHandle);
280
+ if (!_fileInfo) {
281
+ return { statusCode: node_opcua_status_code_1.StatusCodes.BadInvalidArgument };
282
+ }
283
+ const fileData = getFileDataFromContext(context);
284
+ const filename = fileData.filename;
285
+ // make sure file is up to date ... by delegating
286
+ if (mode === open_mode_1.OpenFileMode.Read) {
287
+ yield fileData.refreshFileContent();
288
+ }
289
+ const abstractFs = _getFileSystem(context);
290
+ try {
291
+ _fileInfo.fd = yield (0, util_1.promisify)(abstractFs.open)(filename, flags);
292
+ // update position
293
+ _fileInfo.position = [0, 0];
294
+ const fileLength = (yield (0, util_1.promisify)(abstractFs.stat)(filename)).size;
295
+ _fileInfo.size = fileLength;
296
+ // tslint:disable-next-line:no-bitwise
297
+ if ((mode & open_mode_1.OpenFileModeMask.AppendBit) === open_mode_1.OpenFileModeMask.AppendBit) {
298
+ _fileInfo.position[1] = fileLength;
299
+ }
300
+ if ((mode & open_mode_1.OpenFileModeMask.EraseExistingBit) === open_mode_1.OpenFileModeMask.EraseExistingBit) {
301
+ _fileInfo.size = 0;
302
+ }
303
+ fileData.openCount += 1;
304
+ }
305
+ catch (err) {
306
+ if (err instanceof Error) {
307
+ errorLog(err.message);
308
+ errorLog(err.stack);
309
+ }
310
+ return { statusCode: node_opcua_status_code_1.StatusCodes.BadUnexpectedError };
311
+ }
312
+ debugLog("Opening file handle ", fileHandle, "filename: ", fileData.filename, "openCount: ", fileData.openCount);
313
+ const callMethodResult = {
314
+ outputArguments: [
315
+ {
316
+ dataType: node_opcua_variant_1.DataType.UInt32,
317
+ value: fileHandle
318
+ }
319
+ ],
320
+ statusCode: node_opcua_status_code_1.StatusCodes.Good
321
+ };
322
+ return callMethodResult;
323
+ });
324
+ }
325
+ function _getFileSystem(context) {
326
+ const fs = getFileDataFromContext(context)._fs;
327
+ return fs;
328
+ }
329
+ /**
330
+ * Close is used to close a file represented by a FileType.
331
+ * When a client closes a file the handle becomes invalid.
332
+ *
333
+ * @param inputArguments
334
+ * @param context
335
+ * @private
336
+ */
337
+ function _closeFile(inputArguments, context) {
338
+ return __awaiter(this, void 0, void 0, function* () {
339
+ const abstractFs = _getFileSystem(context);
340
+ const addressSpace = this.addressSpace;
341
+ const fileHandle = inputArguments[0].value;
342
+ const _fileInfo = _getFileInfo(addressSpace, context, fileHandle);
343
+ if (!_fileInfo) {
344
+ return { statusCode: node_opcua_status_code_1.StatusCodes.BadInvalidArgument };
345
+ }
346
+ const fileData = getFileDataFromContext(context);
347
+ debugLog("Closing file handle ", fileHandle, "filename: ", fileData.filename, "openCount: ", fileData.openCount);
348
+ yield (0, util_1.promisify)(abstractFs.close)(_fileInfo.fd);
349
+ _close(addressSpace, context, _fileInfo);
350
+ fileData.openCount -= 1;
351
+ return {
352
+ statusCode: node_opcua_status_code_1.StatusCodes.Good
353
+ };
354
+ });
355
+ }
356
+ /**
357
+ * Read is used to read a part of the file starting from the current file position.
358
+ * The file position is advanced by the number of bytes read.
359
+ *
360
+ * @param inputArguments
361
+ * @param context
362
+ * @private
363
+ */
364
+ function _readFile(inputArguments, context) {
365
+ return __awaiter(this, void 0, void 0, function* () {
366
+ const addressSpace = this.addressSpace;
367
+ const abstractFs = _getFileSystem(context);
368
+ // fileHandle A handle indicating the access request and thus indirectly the
369
+ // position inside the file.
370
+ const fileHandle = inputArguments[0].value;
371
+ // Length Defines the length in bytes that should be returned in data, starting from the current
372
+ // position of the file handle. If the end of file is reached all data until the end of the file is
373
+ // returned.
374
+ let length = inputArguments[1].value;
375
+ // Only positive values are allowed.
376
+ if (length < 0) {
377
+ return { statusCode: node_opcua_status_code_1.StatusCodes.BadInvalidArgument };
378
+ }
379
+ const _fileInfo = _getFileInfo(addressSpace, context, fileHandle);
380
+ if (!_fileInfo) {
381
+ return { statusCode: node_opcua_status_code_1.StatusCodes.BadInvalidState };
382
+ }
383
+ // tslint:disable-next-line:no-bitwise
384
+ if ((_fileInfo.openMode & open_mode_1.OpenFileModeMask.ReadBit) === 0x0) {
385
+ // open mode did not specify Read Flag
386
+ return { statusCode: node_opcua_status_code_1.StatusCodes.BadInvalidState };
387
+ }
388
+ // Spec says that the the Server is allowed to return less data than specified length.
389
+ //
390
+ // In particular, we have to make sure that the number og bytes returned is not greater than
391
+ // the maxChunkSizeBytes specified in the server configuration.
392
+ // length cannot exceed maxChunkSizeBytes
393
+ const fileData = getFileDataFromContext(context);
394
+ const maxChunkSizeBytes = fileData.maxChunkSizeBytes;
395
+ if (length > maxChunkSizeBytes) {
396
+ length = maxChunkSizeBytes;
397
+ }
398
+ // length cannot either exceed ByteStream.maxChunkSizeBytes
399
+ if (length > node_opcua_binary_stream_1.BinaryStream.maxByteStringLength) {
400
+ length = node_opcua_binary_stream_1.BinaryStream.maxByteStringLength;
401
+ }
402
+ // length cannot either exceed transport OPCUA maxMessageLength - some margin.
403
+ const maxMessageSize = (0, node_opcua_address_space_base_1.getContextMaxMessageSize)(context) - 1024;
404
+ if (maxMessageSize > 0 && length > maxMessageSize) {
405
+ length = maxMessageSize;
406
+ }
407
+ // length cannot either exceed remaining buffer size from current position
408
+ length = Math.min(_fileInfo.size - _fileInfo.position[1], length);
409
+ const data = Buffer.alloc(length);
410
+ let ret = { bytesRead: 0 };
411
+ try {
412
+ // note: we do not util.promise here as it has a wierd behavior...
413
+ ret = yield new Promise((resolve, reject) => abstractFs.read(_fileInfo.fd, data, 0, length, _fileInfo.position[1], (err, bytesRead, buff) => {
414
+ if (err) {
415
+ return reject(err);
416
+ }
417
+ return resolve({ bytesRead });
418
+ }));
419
+ _fileInfo.position[1] += ret.bytesRead;
420
+ }
421
+ catch (err) {
422
+ if (err instanceof Error) {
423
+ errorLog("Read error : ", err.message);
424
+ }
425
+ return { statusCode: node_opcua_status_code_1.StatusCodes.BadUnexpectedError };
426
+ }
427
+ // Data Contains the returned data of the file. If the ByteString is empty it indicates that the end
428
+ // of the file is reached.
429
+ return {
430
+ outputArguments: [{ dataType: node_opcua_variant_1.DataType.ByteString, value: data.subarray(0, ret.bytesRead) }],
431
+ statusCode: node_opcua_status_code_1.StatusCodes.Good
432
+ };
433
+ });
434
+ }
435
+ function _writeFile(inputArguments, context) {
436
+ return __awaiter(this, void 0, void 0, function* () {
437
+ const addressSpace = this.addressSpace;
438
+ const abstractFs = _getFileSystem(context);
439
+ const fileHandle = inputArguments[0].value;
440
+ const _fileInfo = _getFileInfo(addressSpace, context, fileHandle);
441
+ if (!_fileInfo) {
442
+ return { statusCode: node_opcua_status_code_1.StatusCodes.BadInvalidArgument };
443
+ }
444
+ // tslint:disable-next-line:no-bitwise
445
+ if ((_fileInfo.openMode & open_mode_1.OpenFileModeMask.WriteBit) === 0x00) {
446
+ // File has not been open with write mode
447
+ return { statusCode: node_opcua_status_code_1.StatusCodes.BadInvalidState };
448
+ }
449
+ const data = inputArguments[1].value;
450
+ let ret = { bytesWritten: 0 };
451
+ try {
452
+ // note: we do not util.promise here as it has a wierd behavior...
453
+ ret = yield new Promise((resolve, reject) => {
454
+ abstractFs.write(_fileInfo.fd, data, 0, data.length, _fileInfo.position[1], (err, bytesWritten) => {
455
+ if (err) {
456
+ errorLog("Err", err);
457
+ return reject(err);
458
+ }
459
+ return resolve({ bytesWritten });
460
+ });
461
+ });
462
+ (0, node_opcua_assert_1.assert)(typeof ret.bytesWritten === "number");
463
+ _fileInfo.position[1] += ret.bytesWritten;
464
+ _fileInfo.size = Math.max(_fileInfo.size, _fileInfo.position[1]);
465
+ const fileData = getFileDataFromContext(context);
466
+ debugLog(fileData.fileSize);
467
+ fileData.fileSize = Math.max(fileData.fileSize, _fileInfo.position[1]);
468
+ debugLog(fileData.fileSize);
469
+ }
470
+ catch (err) {
471
+ if (err instanceof Error) {
472
+ errorLog("Write error : ", err.message);
473
+ }
474
+ return { statusCode: node_opcua_status_code_1.StatusCodes.BadUnexpectedError };
475
+ }
476
+ return {
477
+ outputArguments: [],
478
+ statusCode: node_opcua_status_code_1.StatusCodes.Good
479
+ };
480
+ });
481
+ }
482
+ function _setPositionFile(inputArguments, context) {
483
+ return __awaiter(this, void 0, void 0, function* () {
484
+ const addressSpace = this.addressSpace;
485
+ const fileHandle = inputArguments[0].value;
486
+ const position = inputArguments[1].value;
487
+ const _fileInfo = _getFileInfo(addressSpace, context, fileHandle);
488
+ if (!_fileInfo) {
489
+ return { statusCode: node_opcua_status_code_1.StatusCodes.BadInvalidArgument };
490
+ }
491
+ _fileInfo.position = position;
492
+ return { statusCode: node_opcua_status_code_1.StatusCodes.Good };
493
+ });
494
+ }
495
+ function _getPositionFile(inputArguments, context) {
496
+ return __awaiter(this, void 0, void 0, function* () {
497
+ const addressSpace = this.addressSpace;
498
+ const fileHandle = inputArguments[0].value;
499
+ const _fileInfo = _getFileInfo(addressSpace, context, fileHandle);
500
+ if (!_fileInfo) {
501
+ return { statusCode: node_opcua_status_code_1.StatusCodes.BadInvalidArgument };
502
+ }
503
+ return {
504
+ outputArguments: [
505
+ {
506
+ arrayType: node_opcua_variant_1.VariantArrayType.Scalar,
507
+ dataType: node_opcua_variant_1.DataType.UInt64,
508
+ value: _fileInfo.position
509
+ }
510
+ ],
511
+ statusCode: node_opcua_status_code_1.StatusCodes.Good
512
+ };
513
+ });
514
+ }
515
+ exports.defaultMaxSize = 100000000;
516
+ function install_method_handle_on_type(addressSpace) {
517
+ const fileType = addressSpace.findObjectType("FileType");
518
+ if (fileType.open.isBound()) {
519
+ return;
520
+ }
521
+ fileType.open.bindMethod(_openFile);
522
+ fileType.close.bindMethod(_closeFile);
523
+ fileType.read.bindMethod(_readFile);
524
+ fileType.write.bindMethod(_writeFile);
525
+ fileType.setPosition.bindMethod(_setPositionFile);
526
+ fileType.getPosition.bindMethod(_getPositionFile);
527
+ }
528
+ /**
529
+ * bind all methods of a UAFile OPCUA node
530
+ * @param file the OPCUA Node that has a typeDefinition of FileType
531
+ * @param options the options
532
+ */
533
+ function installFileType(_file, options) {
534
+ const file = _file;
535
+ if (file.$fileData) {
536
+ errorLog("File already installed ", file.nodeId.toString(), file.browseName.toString());
537
+ return;
538
+ }
539
+ // make sure that FileType methods are also bound.
540
+ install_method_handle_on_type(file.addressSpace);
541
+ // to protect the server we setup a maximum limit in bytes on the file
542
+ // if the client try to access or set the position above this limit
543
+ // the server will return an error
544
+ options.maxSize = options.maxSize === undefined ? exports.defaultMaxSize : options.maxSize;
545
+ const $fileData = new FileTypeData(options, file);
546
+ file.$fileData = $fileData;
547
+ // ----- install mime type
548
+ if (options.mimeType) {
549
+ if (file.mimeType) {
550
+ file.mimeType.bindVariable({
551
+ get: () => new node_opcua_variant_1.Variant({ dataType: node_opcua_variant_1.DataType.String, value: file.$fileData.mimeType })
552
+ });
553
+ }
554
+ }
555
+ file.open.bindMethod(_openFile);
556
+ file.close.bindMethod(_closeFile);
557
+ file.read.bindMethod(_readFile);
558
+ file.write.bindMethod(_writeFile);
559
+ file.setPosition.bindMethod(_setPositionFile);
560
+ file.getPosition.bindMethod(_getPositionFile);
561
+ }
562
+ exports.installFileType = installFileType;
563
+ //# sourceMappingURL=file_type_helpers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"file_type_helpers.js","sourceRoot":"","sources":["../../source/server/file_type_helpers.ts"],"names":[],"mappings":";AAAA;;GAEG;;;;;;;;;;;;AAEH,+BAA8C;AAC9C,6BAA6B;AAE7B,yDAA2C;AAC3C,iFAEwC;AAWxC,uEAAwD;AACxD,uDAAiG;AACjG,yDAAmE;AAEnE,mEAAqD;AACrD,2DAAyE;AAEzE,4CAA8D;AAG9D,MAAM,QAAQ,GAAG,IAAA,gCAAa,EAAC,UAAU,CAAC,CAAC;AAC3C,MAAM,QAAQ,GAAG,IAAA,gCAAa,EAAC,UAAU,CAAC,CAAC;AAC3C,MAAM,UAAU,GAAG,IAAA,kCAAe,EAAC,UAAU,CAAC,CAAC;AAC/C,MAAM,OAAO,GAAG,IAAA,iCAAc,EAAC,UAAU,CAAC,CAAC;AAkC3C;;GAEG;AACH,MAAa,YAAY;IAerB,Y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,CAAC;IAClC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC;IAChC,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC;IAClC,IAAI,CAAC,WAAW,CAAC,UAAU,CAAC,gBAAgB,CAAC,CAAC;IAC9C,IAAI,CAAC,WAAW,CAAC,UAAU,CAAC,gBAAgB,CAAC,CAAC;AAClD,CAAC;AAjCD,0CAiCC"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "node-opcua-file-transfer",
3
- "version": "2.98.0",
4
- "description": "pure nodejs OPCUA SDK - module -server",
3
+ "version": "2.98.2",
4
+ "description": "pure nodejs OPCUA SDK - module file-transfer",
5
5
  "scripts": {
6
6
  "build": "tsc -b",
7
7
  "lint": "eslint source/**/*.ts",
@@ -15,28 +15,28 @@
15
15
  "npm": ">=8.x"
16
16
  },
17
17
  "dependencies": {
18
- "node-opcua-address-space": "2.98.0",
19
- "node-opcua-address-space-base": "2.98.0",
20
- "node-opcua-assert": "2.88.0",
21
- "node-opcua-basic-types": "2.98.0",
22
- "node-opcua-binary-stream": "2.98.0",
23
- "node-opcua-constants": "2.88.0",
24
- "node-opcua-data-model": "2.98.0",
25
- "node-opcua-debug": "2.98.0",
26
- "node-opcua-nodeid": "2.98.0",
27
- "node-opcua-pseudo-session": "2.98.0",
28
- "node-opcua-service-call": "2.98.0",
29
- "node-opcua-service-read": "2.98.0",
30
- "node-opcua-service-translate-browse-path": "2.98.0",
31
- "node-opcua-status-code": "2.98.0",
32
- "node-opcua-variant": "2.98.0"
18
+ "node-opcua-address-space": "2.98.2",
19
+ "node-opcua-address-space-base": "2.98.2",
20
+ "node-opcua-assert": "2.98.1",
21
+ "node-opcua-basic-types": "2.98.1",
22
+ "node-opcua-binary-stream": "2.98.1",
23
+ "node-opcua-constants": "2.98.1",
24
+ "node-opcua-data-model": "2.98.1",
25
+ "node-opcua-debug": "2.98.1",
26
+ "node-opcua-nodeid": "2.98.1",
27
+ "node-opcua-pseudo-session": "2.98.2",
28
+ "node-opcua-service-call": "2.98.2",
29
+ "node-opcua-service-read": "2.98.2",
30
+ "node-opcua-service-translate-browse-path": "2.98.2",
31
+ "node-opcua-status-code": "2.98.1",
32
+ "node-opcua-variant": "2.98.1"
33
33
  },
34
34
  "devDependencies": {
35
35
  "memfs": "^3.5.0",
36
- "node-opcua": "2.98.0",
37
- "node-opcua-client": "2.98.0",
38
- "node-opcua-leak-detector": "2.98.0",
39
- "node-opcua-nodesets": "2.98.0",
36
+ "node-opcua": "2.98.2",
37
+ "node-opcua-client": "2.98.2",
38
+ "node-opcua-leak-detector": "2.98.1",
39
+ "node-opcua-nodesets": "2.98.2",
40
40
  "should": "^13.2.3"
41
41
  },
42
42
  "author": "Etienne Rossignon",
@@ -54,5 +54,9 @@
54
54
  "internet of things"
55
55
  ],
56
56
  "homepage": "http://node-opcua.github.io/",
57
- "gitHead": "07dcdd8e8c7f2b55544c6e23023093e35674829c"
57
+ "gitHead": "6df8aa25475ba1235e585566cb2dec68b7e7a85f",
58
+ "files": [
59
+ "dist",
60
+ "source"
61
+ ]
58
62
  }