处理用的NodeJS流AngularJS [英] Handling Nodejs streams with AngularJS
问题描述
我使用的NodeJS流(使用性LevelDB)从我的级别的数据库获取数据。这里是code我用的一个片段:
I am using nodejs streams to fetch data from my level database (using leveldb). Here is a snippet of the code I use:
app.get('/my/route', function (req, res, next) {
leveldb.createValueStream(options)
.pipe(map.obj(function (hash) {
level.get(somekeys, function (err, item) {
return item
})
}))
.pipe(res)
})
到目前为止,我一直在使用列表流
模块获得在客户端的数据。
So far, I have been using the list-stream
module to get the data on the client side.
现在我想检索客户端作为流的信息。我读过这篇文章(<一个href=\"http://www.kdelemme.com/2014/04/24/use-socket-io-to-stream-tweets-between-nodejs-and-angularjs/\" rel=\"nofollow\">http://www.kdelemme.com/2014/04/24/use-socket-io-to-stream-tweets-between-nodejs-and-angularjs/)如何做到这一点使用socket.io但我不希望使用socket.io
Now I'd like to retrieve the information on the client side as a stream. I've read this post (http://www.kdelemme.com/2014/04/24/use-socket-io-to-stream-tweets-between-nodejs-and-angularjs/) on how to do it using socket.io but I don't want to use socket.io
有没有简单的方法来做到这一点?
Is there any simple way to do it?
推荐答案
这可以和擦鞋完成。你必须编译客户端code。与browserify,你可以在从服务器接收数据浏览器中的数据流。
This can be done with Shoe. You have to compile the client code with browserify and you can have a stream in the browser that receives the data from the server.
这篇关于处理用的NodeJS流AngularJS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!