{"_id":"@voicenter-team/tcp-transfer","_rev":"30-d1762c3f025e151f9414704c7d3b3b1c","name":"@voicenter-team/tcp-transfer","dist-tags":{"latest":"0.0.9"},"versions":{"0.0.2":{"name":"@voicenter-team/tcp-transfer","version":"0.0.2","author":{"name":"tzachi.sh"},"license":"ISC","_id":"@voicenter-team/tcp-transfer@0.0.2","maintainers":[{"name":"tzachish","email":"Tzachi.shirazi@gmail.com"},{"name":"regani","email":"bohdan.konechniy@gmail.com"},{"name":"bohdan.du","email":"bohdan.du@starkey.co.il"}],"dist":{"shasum":"51c7a8b8014e2d846a0cb7cf6891d7afb924c336","tarball":"https://registry.npmjs.org/@voicenter-team/tcp-transfer/-/tcp-transfer-0.0.2.tgz","fileCount":8,"integrity":"sha512-9VDxevUgBz03KIZioVsG3uAV2b5NZRbVou+WbgMCeBjj1xz71JDJnpye6sXHBf3J5Cza/bkIgc1rhZ/ojJHAkQ==","signatures":[{"sig":"MEUCIBrppw5nsE4Pc35fMAbVLPwd1LroJXxPYwJKEEzKkha1AiEAkP7lNqOMZojn8prBZ4ZmkG5iVH4k8zL5e/6rcod3T4Y=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":26482},"main":"index.js","gitHead":"51775594be90d3ce94dc4c459779d0ac281c67ed","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"_npmUser":{"name":"tzachish","email":"Tzachi.shirazi@gmail.com"},"_npmVersion":"10.9.0","description":"A Node.js module for reliable TCP file transfer between client and server with support for failover connections.","directories":{},"_nodeVersion":"22.11.0","dependencies":{"uuid":"^11.0.5"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/tcp-transfer_0.0.2_1739270820900_0.9852763738135877","host":"s3://npm-registry-packages-npm-production"}},"0.0.3":{"name":"@voicenter-team/tcp-transfer","version":"0.0.3","author":{"name":"tzachi.sh"},"license":"ISC","_id":"@voicenter-team/tcp-transfer@0.0.3","maintainers":[{"name":"tzachish","email":"Tzachi.shirazi@gmail.com"},{"name":"regani","email":"bohdan.konechniy@gmail.com"},{"name":"bohdan.du","email":"bohdan.du@starkey.co.il"}],"dist":{"shasum":"9ae3c794ea8911a5a5d577c23b43a89477c5ea7a","tarball":"https://registry.npmjs.org/@voicenter-team/tcp-transfer/-/tcp-transfer-0.0.3.tgz","fileCount":8,"integrity":"sha512-1eZ9kODBC7gJR64lxHVgpEIY8/SqXbrLAi0LdMNGhmr3FoL4iLLh0jQTixST4e+dwysMlUVGuegF6b8EEHUCEA==","signatures":[{"sig":"MEQCIBa/HlqQJ2ZL2/sNIid1F9kS3AfAI3fNR9aIV3KUwdPHAiA50vVKxVaJFsas7RDOTXJcFu2IKjHQT89+p6mI7bn1JQ==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":26853},"main":"index.js","gitHead":"27c1f81f24ebbfea5096aaf5b082312e92a1342f","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"_npmUser":{"name":"tzachish","email":"Tzachi.shirazi@gmail.com"},"_npmVersion":"10.9.0","description":"A Node.js module for reliable TCP file transfer between client and server with support for failover connections.","directories":{},"_nodeVersion":"22.11.0","dependencies":{"uuid":"^11.0.5"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/tcp-transfer_0.0.3_1739272687904_0.7522228064034127","host":"s3://npm-registry-packages-npm-production"}},"0.0.4":{"name":"@voicenter-team/tcp-transfer","version":"0.0.4","author":{"name":"tzachi.sh"},"license":"ISC","_id":"@voicenter-team/tcp-transfer@0.0.4","maintainers":[{"name":"tzachish","email":"Tzachi.shirazi@gmail.com"},{"name":"regani","email":"bohdan.konechniy@gmail.com"},{"name":"bohdan.du","email":"bohdan.du@starkey.co.il"}],"dist":{"shasum":"07c434ab140170257719e2fcb7203033c77391a4","tarball":"https://registry.npmjs.org/@voicenter-team/tcp-transfer/-/tcp-transfer-0.0.4.tgz","fileCount":8,"integrity":"sha512-iv4ovsnHgiomb0m5yVPjvShlQ1P7YJyhCkLBJQL/mNwdg3e9KEYVhp9aC6TXGk1XeX7VOv6hiUDnGvLdZcx8Qg==","signatures":[{"sig":"MEUCIC/KX6Ru/NVnHJZ7DGjgpLZhdj4g91vV+wrhfRxzX17gAiEA3906xIu2nkYEZsxSvzhwpWBaNc4kqrFxd8ZsyTgI8ag=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":26158},"main":"index.js","gitHead":"9863aa73e274e9e95b2e2f69ce98abf29c5ac426","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"_npmUser":{"name":"tzachish","email":"Tzachi.shirazi@gmail.com"},"_npmVersion":"10.2.3","description":"A Node.js module for reliable TCP file transfer between client and server with support for failover connections.","directories":{},"_nodeVersion":"20.10.0","dependencies":{"uuid":"^11.0.5"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/tcp-transfer_0.0.4_1739374084574_0.7552440717039297","host":"s3://npm-registry-packages-npm-production"}},"0.0.5":{"name":"@voicenter-team/tcp-transfer","version":"0.0.5","author":{"name":"tzachi.sh"},"license":"ISC","_id":"@voicenter-team/tcp-transfer@0.0.5","maintainers":[{"name":"tzachish","email":"Tzachi.shirazi@gmail.com"},{"name":"regani","email":"bohdan.konechniy@gmail.com"},{"name":"bohdan.du","email":"bohdan.du@starkey.co.il"}],"dist":{"shasum":"029540e17f20aec83d43b1c4a942f579b329c680","tarball":"https://registry.npmjs.org/@voicenter-team/tcp-transfer/-/tcp-transfer-0.0.5.tgz","fileCount":8,"integrity":"sha512-WOYwh9Ux1JlXqvTQiJ4pjMglwdHObKhbnXIromfnl+93/fsy02S8CBb5etak7Z3Evjd1YPQjXAy3UWjoCeBYqA==","signatures":[{"sig":"MEQCICNsAFDeBPyWvSr3S50iyL6px0k0M41+BnZkljjBa7sgAiAIlZRdgZUhonNMfVutDAZV7YmOnj0WWFHFQ5DoLuhutg==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":26198},"main":"index.js","gitHead":"9863aa73e274e9e95b2e2f69ce98abf29c5ac426","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"_npmUser":{"name":"tzachish","email":"Tzachi.shirazi@gmail.com"},"_npmVersion":"10.2.3","description":"A Node.js module for reliable TCP file transfer between client and server with support for failover connections.","directories":{},"_nodeVersion":"20.10.0","dependencies":{"uuid":"^11.0.5"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/tcp-transfer_0.0.5_1739385089042_0.8184362225538739","host":"s3://npm-registry-packages-npm-production"}},"0.0.8":{"name":"@voicenter-team/tcp-transfer","version":"0.0.8","author":{"name":"tzachi.sh"},"license":"ISC","_id":"@voicenter-team/tcp-transfer@0.0.8","maintainers":[{"name":"tzachish","email":"Tzachi.shirazi@gmail.com"},{"name":"regani","email":"bohdan.konechniy@gmail.com"},{"name":"bohdan.du","email":"bohdan.du@starkey.co.il"}],"dist":{"shasum":"2b931bc73609111159b0fa243d3b59f6c02371f8","tarball":"https://registry.npmjs.org/@voicenter-team/tcp-transfer/-/tcp-transfer-0.0.8.tgz","fileCount":8,"integrity":"sha512-Xh6D9f9Cz+6RFQ1CoAl2UULE6P9PlFpa1sFoLOU1afqroS9s/LrR4aGPAzJxTNpt+If5xqnUmgyQEFyUxbkd+g==","signatures":[{"sig":"MEUCICs4kUFCrGxX65kbPD0XlI+8FVwrb4Vb8q0DAw9xHwoXAiEAl1ihmi05aCKaqQnR7qdQHGwLKNp/Adcx25MkljgEa/E=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":34330},"main":"index.js","gitHead":"fa24e514a0022afb3bb45b95ff7821e7ad80b871","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"_npmUser":{"name":"tzachish","email":"Tzachi.shirazi@gmail.com"},"_npmVersion":"10.8.1","description":"A Node.js module for reliable TCP file transfer between client and server with support for failover connections, streaming, and robust error handling.","directories":{},"_nodeVersion":"20.16.0","dependencies":{"uuid":"^11.0.5"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/tcp-transfer_0.0.8_1739462867090_0.6594962875610679","host":"s3://npm-registry-packages-npm-production"}},"0.0.9":{"name":"@voicenter-team/tcp-transfer","version":"0.0.9","author":{"name":"tzachi.sh"},"license":"ISC","_id":"@voicenter-team/tcp-transfer@0.0.9","maintainers":[{"name":"tzachish","email":"Tzachi.shirazi@gmail.com"},{"name":"regani","email":"bohdan.konechniy@gmail.com"},{"name":"bohdan.du","email":"bohdan.du@starkey.co.il"}],"dist":{"shasum":"9c391fd131ff86324f45f1c7cd5a75da53e48fc8","tarball":"https://registry.npmjs.org/@voicenter-team/tcp-transfer/-/tcp-transfer-0.0.9.tgz","fileCount":8,"integrity":"sha512-wqlGUuTfoxVDFQLbg6v8WKu9inbMOMHImQc9BDRPjTOs0BJtbmBB+2od1x34CJtV7q6tIYCl17smQlSsZQAKVg==","signatures":[{"sig":"MEQCICLR6VyqYeGd3ShsxHeCD7HN1jYeiFJjqeG4NqPKQzxJAiBc5B/sTtNrEtYbgVJpsHnA1nO6mOetmst5P8XsCYHU0w==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":34488},"main":"index.js","gitHead":"526bed1318d7b6a03034cc1a497250de052c78b4","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"_npmUser":{"name":"tzachish","actor":{"name":"tzachish","type":"user","email":"Tzachi.shirazi@gmail.com"},"email":"Tzachi.shirazi@gmail.com"},"_npmVersion":"10.9.0","description":"A Node.js module for reliable TCP file transfer between client and server with support for failover connections, streaming, and robust error handling.","directories":{},"_nodeVersion":"22.11.0","dependencies":{"uuid":"^11.0.5"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/tcp-transfer_0.0.9_1752144579447_0.5663523801541086","host":"s3://npm-registry-packages-npm-production"}}},"time":{"created":"2025-02-11T10:47:00.899Z","modified":"2026-04-26T17:08:09.575Z","1.0.1":"2025-02-09T15:42:23.193Z","1.0.2":"2025-02-09T15:48:06.751Z","1.0.3":"2025-02-09T17:09:06.655Z","1.0.4":"2025-02-09T17:21:08.894Z","1.0.5":"2025-02-10T16:44:12.951Z","1.0.6":"2025-02-10T16:56:19.764Z","0.0.1":"2025-02-11T09:51:31.284Z","0.0.2":"2025-02-11T10:47:01.091Z","0.0.3":"2025-02-11T11:18:08.081Z","0.0.4":"2025-02-12T15:28:04.754Z","0.0.5":"2025-02-12T18:31:29.232Z","0.0.6":"2025-02-13T15:52:31.095Z","0.0.7":"2025-02-13T16:03:40.300Z","0.0.8":"2025-02-13T16:07:47.314Z","0.0.9":"2025-07-10T10:49:39.625Z"},"author":{"name":"tzachi.sh"},"license":"ISC","description":"A Node.js module for reliable TCP file transfer between client and server with support for failover connections, streaming, and robust error handling.","maintainers":[{"email":"Tzachi.shirazi@gmail.com","name":"tzachish"},{"email":"bohdan.konechniy@gmail.com","name":"regani"},{"email":"zeev@voicenter.com","name":"zeev.oliker"},{"email":"nitzan@starkey.co.il","name":"nitzan-npm"},{"email":"bohdan.du@starkey.co.il","name":"bohdan.du"}],"readme":"# TCP File Transfer\r\n\r\nA Node.js module for reliable TCP file transfer between client and server with support for failover connections, streaming, and robust error handling.\r\n\r\n## Features\r\n\r\n- TCP-based file transfer client and server\r\n- Support for failover connections with multiple server endpoints\r\n- File streaming support with Transform streams\r\n- Connection retry mechanism with configurable attempts\r\n- Event-based progress monitoring and error handling\r\n- Temporary file handling\r\n- Configurable timeouts and connection limits\r\n- Protocol versioning and checksum validation\r\n- Support for both file and stream transfers\r\n\r\n## Installation\r\n\r\n```bash\r\nnpm install @voicenter-team/tcp-transfer\r\n```\r\n\r\n## Usage\r\n\r\n### Starting a Server\r\n\r\n```javascript\r\nconst NetFile = require('@voicenter-team/tcp-transfer');\r\nconst netFile = new NetFile();\r\n\r\nconst startServer = async () => {\r\n  // Create server instance\r\n  const server = new netFile.Server({\r\n    port: 4000,\r\n    maxConnections: 5,\r\n    timeout: 20000,\r\n    tempDir: './temp'\r\n  });\r\n\r\n  // Handle server events\r\n  server.on(NetFile.ServerEvents.SERVER_STARTED, (info) => {\r\n    console.log(`Server started on port ${info.port}`);\r\n  });\r\n\r\n  server.on(NetFile.ServerEvents.NEW_CONNECTION, (info) => {\r\n    console.log(`New connection ${info.connectionId}`);\r\n  });\r\n\r\n  server.on(NetFile.ServerEvents.FILE_TRANSFERRED, (connection) => {\r\n    console.log('File transferred:', connection.metadata);\r\n    \r\n    // Process the file and send response\r\n    connection.send({\r\n      type: 'processing_status',\r\n      status: 'complete',\r\n      receivedBytes: connection.receivedBytes,\r\n      data: { result: 'success' }\r\n    });\r\n  });\r\n\r\n  // Start the server\r\n  await server.start();\r\n}\r\n```\r\n\r\n### Using the Client\r\n\r\n```javascript\r\nconst NetFile = require('@voicenter-team/tcp-transfer');\r\nconst netFile = new NetFile();\r\nconst fs = require('fs');\r\nconst path = require('path');\r\n\r\n// File Transfer Example\r\nconst sendFile = async () => {\r\n  try {\r\n    const client = await netFile.failoverClient(\r\n      ['tcp://localhost:4002', 'tcp://localhost:4000'],\r\n      { connectionTimeOut: 3600000 } // 1 hour\r\n    );\r\n\r\n    client.on('info', (info) => console.log('Client info:', info));\r\n    \r\n    const response = await client.sendFile('./path/to/file.wav');\r\n    console.log('Transfer response:', response);\r\n  } catch (err) {\r\n    console.error('Error:', err);\r\n  }\r\n};\r\n\r\n// Stream Transfer Example\r\nconst streamTransfer = async () => {\r\n  try {\r\n    const client = await netFile.failoverClient(['tcp://localhost:4000']);\r\n    const filePath = './path/to/file.wav';\r\n    const fileStats = fs.statSync(filePath);\r\n    const fileStream = fs.createReadStream(filePath);\r\n\r\n    const response = await client.transfer(fileStream, {\r\n      filename: path.basename(filePath),\r\n      fileSize: fileStats.size,\r\n      responseTimeOut: 6000\r\n    });\r\n    \r\n    console.log('Stream transfer response:', response);\r\n  } catch (err) {\r\n    console.error('Error:', err);\r\n  }\r\n};\r\n```\r\n\r\n## API Reference\r\n\r\n### Server Class\r\n\r\n#### Constructor Options\r\n```javascript\r\n{\r\n  port: 4000,              // Server port number\r\n  maxConnections: 5,       // Maximum concurrent connections\r\n  timeout: 20000,          // Connection timeout in ms\r\n  tempDir: './temp'        // Directory for temporary files\r\n}\r\n```\r\n\r\n#### Events\r\n- `SERVER_STARTED` - Server started successfully\r\n- `NEW_CONNECTION` - New client connected\r\n- `CONNECTION_CLOSED` - Client disconnected\r\n- `SERVER_ERROR` - Server error occurred\r\n- `FILE_TRANSFERRED` - File transfer completed\r\n- `CONNECTION_REJECTED` - Connection rejected (max connections reached)\r\n\r\n### Client Class\r\n\r\n#### Constructor Options\r\n```javascript\r\n{\r\n  connectionTimeOut: 10000,  // Connection timeout in ms\r\n  timeoutAttempt: 2000,     // Retry attempt timeout in ms\r\n  maxRetries: 3             // Maximum connection retries\r\n}\r\n```\r\n\r\n#### Methods\r\n- `connect()` - Establish connection to server\r\n- `sendFile(filePath, options)` - Send a file\r\n- `transfer(stream, options)` - Transfer a stream\r\n- `disconnect()` - Close connection\r\n\r\n#### Events\r\n- `info` - Transfer progress information\r\n- `error` - Error information\r\n- `connection` - Connection status\r\n- `transfer` - Transfer status\r\n- `message` - Server messages\r\n\r\n### Protocol Class\r\n\r\nHandles message formatting, checksums, and versioning for reliable data transfer.\r\n\r\n```javascript\r\n{\r\n  maxLength: 32 * 1024 * 1024,  // Maximum message length (32MB)\r\n  timeoutMs: 45000              // Message timeout (45 seconds)\r\n}\r\n```\r\n\r\n## Error Handling\r\n\r\nThe module includes comprehensive error handling for:\r\n- Connection failures\r\n- Transfer timeouts\r\n- Maximum connection limits\r\n- Protocol version mismatches\r\n- Checksum validation\r\n- Stream errors\r\n\r\n## License\r\n\r\nMIT\r\n\r\n## Contributing\r\n\r\nPull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.\r\n```","readmeFilename":"README.MD"}