Comments (4)
For this usecase you can call send_response_to_client
and return veb.no_result
: https://github.com/vlang/v/blob/master/vlib/veb/README.md#empty-result
If your usecase is sending a file you can also use veb's new ctx.file
method
https://github.com/vlang/v/blob/master/vlib/veb/README.md#sending-files
The file
method sends the data in a stream towards the browser and will be faster than your current implementation.
pub fn (mut app App) video(mut ctx Context) vweb.Result {
return ctx.file('path/to/mp4/file')
}
(haven't tested the code)
from v.
For this usecase you can call
send_response_to_client
and returnveb.no_result
: https://github.com/vlang/v/blob/master/vlib/veb/README.md#empty-resultIf your usecase is sending a file you can also use veb's new
ctx.file
method https://github.com/vlang/v/blob/master/vlib/veb/README.md#sending-filesThe
file
method sends the data in a stream towards the browser and will be faster than your current implementation.pub fn (mut app App) video(mut ctx Context) vweb.Result { return ctx.file('path/to/mp4/file') }(haven't tested the code)
Thank you for the response.
- The veb and vweb Result types are not compatible...
- If you send file with the following code
pub fn (mut app App) video2() vweb.Result {
return app.Context.file('path/to/mp4/file')
}
Yes, indeed it is "faster" but the seeking option for the video file not working now...
So thank you, but your answer is not good. On the other hand, I found the workaround this way:
app.Context.send_response_to_client('video/mp4', buf.bytestr())
return vweb.not_found()
from v.
vweb
is deprecated. veb
is the newer web code. The suggestion was for veb
, not vweb
.
from v.
vweb
is deprecated.veb
is the newer web code. The suggestion was forveb
, notvweb
.
I rewrote just this part, to veb
and the file still not sent as partial, and not seekable, sorry still not good for me usecase. I will rewrite the rest of it too, but I got my answer. Thank you anyways.
from v.
Related Issues (20)
- radamsa HOT 1
- V parser segfault, when run with `-silent`, discovered through radamsa HOT 2
- mysql bug on macosx
- parser crash, discovered through radamsa HOT 6
- parser panic for reaching eof too many times, discovered through radamsa
- V parser panic, discovered through radamsa, when using `cmd/tools/measure/parser_speed` HOT 1
- V parser segfault with `v -silent bug6.v`, discovered through radamsa HOT 2
- V parser segfault with `-silent`, discovered with radamsa, for a very long `-----n----m------` pattern. HOT 1
- can not use generic lambda expression as parameter to generic function over 2 generic types
- Failed to compile C2V HOT 7
- Support splitting Strings into Unicode Grapheme Cluster
- Regex module ignores ^ and $
- mac: Checking for existence of a key in a map using the 'in' keyword causes a segfault HOT 7
- compile of tvintris.v failed HOT 11
- Test failed on OpenBSD for vlib/os/os_stat_test.v HOT 1
- Test failed on OpenBSD for vlib/net/http/server_test.v
- Build fails on OpenBSD with clang and cstrict compilation HOT 3
- Map of fixed array initialisations HOT 4
- veb: parallel event loop HOT 5
- struct embedding must be declared at the beginning of the struct body HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from v.