![PyPI Now Supports iOS and Android Wheels for Mobile Python Development](https://cdn.sanity.io/images/cgdhsj6q/production/96416c872705517a6a65ad9646ce3e7caef623a0-1024x1024.webp?w=400&fit=max&auto=format)
Security News
PyPI Now Supports iOS and Android Wheels for Mobile Python Development
PyPI now supports iOS and Android wheels, making it easier for Python developers to distribute mobile packages.
@ryanaltair/socket.io-stream
Advanced tools
Upload file as stream with socket.io, fork from @Akumzy/socket.io-stream
socket.io based file stream
This package has three components
Only works in Nodejs environment like in ElectronJs.
Web is for browsers based app the component uses FileReader api to read file blob.
This component handlers all the request from both Web
and Client
//Client
import { Client } from '@ryanaltair/socket.io-stream'
const client = new Client(socket, {
filepath: '/path/to/file/music.mp3',
data: {
//you pass your own data here
name: 'music.mp3'
}
})
client
.upload('file-upload', data => {
console.log({ data })
})
.on('progress', c => {
console.log(c) //{total,size}
})
.on('done', data => {
console.log(data)
})
.on('pause', () => {
console.log('pause')
})
.on('cancel', () => {
console.log('canceled')
})
//Web
function onChange(inputElement) {
let file = inputElement.files[0]
const client = new Web(socket, {
file: file,
data: {
name: file.name
}
})
client
.upload('file-upload', data => {
console.log({ data })
})
.on('progress', c => {
console.log(c) //{total,size}
})
.on('done', data => {
console.log(data)
})
.on('pause', () => {
console.log('pause')
})
.on('cancel', () => {
console.log('canceled')
})
}
//Server
import { Server } from '@ryanaltair/socket.io-stream'
import { appendFileSync } from 'fs'
const io = require('socket.io')(8090)
io.on('connection', socket => {
const server = new Server(socket)
server.on('file-upload', async ({ stream, data, ready }, ack) => {
try {
await someTask()
ready()
stream.subscribe({
next({ buffer, flag }) {
appendFile(data.name, buffer, {
encoding: 'binary',
flag
})
},
complete() {
ack(null, [1, 2, 3])
},
error(err) {
ack(err)
console.error(err)
}
})
} catch (err) {
console.error(err)
}
})
})
Please check the example folder for clue on how to use package until I'm able to document this package well
FAQs
Upload file as stream with socket.io, fork from @Akumzy/socket.io-stream
The npm package @ryanaltair/socket.io-stream receives a total of 1 weekly downloads. As such, @ryanaltair/socket.io-stream popularity was classified as not popular.
We found that @ryanaltair/socket.io-stream demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
PyPI now supports iOS and Android wheels, making it easier for Python developers to distribute mobile packages.
Security News
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.