小编Bil*_*rus的帖子

如何从Node.js Express应用程序中将远程URL文件作为GET响应发送?

上下文:使用Express的多层Node.js应用程序.前端托管为Azure网站,后端数据来自Parse.

我有一个GET端点,我希望用户体验是文件下载.如果该文件与我的前端位于同一服务器中,我可以使用

res.sendfile(localPath);
Run Code Online (Sandbox Code Playgroud)

但是,该文件由我的后端托管在另一台服务器上,我的所有前端都知道是URL.所以我现在正在做:

res.redirect(externalURL);
Run Code Online (Sandbox Code Playgroud)

这导致浏览器导航到资产文件URL(这是一个视频)并显示在浏览器中.我想知道的是:如何让浏览器下载该文件而只是停留在同一页面?

我已经在这上面搜了一会儿,如果没有先将文件下载到我前端的临时文件中,我就没有办法做到这一点,我显然不愿意这样做.这可能是HTTP 101的东西,所以我感谢任何帮助!

javascript http node.js express

20
推荐指数
1
解决办法
1万
查看次数

类型 androidx.appcompat.resources.R$dimen 被定义多次

我们有一个 React Native 应用程序,在升级到 Android Studio 3.6.1 和 Gradle 插件 3.6.1 后,我们看到了这个编译错误:

Type androidx.appcompat.resources.R$dimen is defined multiple times: /Users/andrew/Software/project/android/app/build/intermediates/project_dex_archive/productionRelease/out/androidx/appcompat/resources/R$dimen.dex, /Users/andrew/Software/project/android/app/build/intermediates/project_dex_archive/productionRelease/out/15bdf8225afad69777cd7f9bd328ab094900c8289014e0107b56c5c62099dfea_3.jar:classes.dex
Run Code Online (Sandbox Code Playgroud)

这是我们的依赖项:

"dependencies": {
    "@dblackker/cameraroll": "^1.3.4",
    "@react-native-community/async-storage": "^1.7.1",
    "@react-native-community/geolocation": "^2.0.2",
    "@react-native-community/netinfo": "^4.4.0",
    "@react-native-community/push-notification-ios": "^1.0.6",
    "@react-native-firebase/analytics": "^6.2.0",
    "@react-native-firebase/app": "^6.2.0",
    "@react-native-firebase/crashlytics": "^6.2.0",
    "@react-native-firebase/perf": "^6.2.0",
    "appcenter": "^2.6.1",
    "appcenter-analytics": "^2.6.1",
    "appcenter-crashes": "^2.6.1",
    "axios": "^0.18.0",
    "clone": "^2.1.2",
    "immutability-helper": "^2.8.1",
    "lodash": "^4.17.14",
    "memoize-one": "^5.1.1",
    "moment": "^2.22.2",
    "prop-types": "^15.7.2",
    "react": "16.9.0",
    "react-custom-validation": "^0.5.7",
    "react-native": "0.61.5",
    "react-native-add-calendar-event": "^3.0.0",
    "react-native-app-intro-slider": "^3.0.0",
    "react-native-appearance": "^0.3.1",
    "react-native-camera": "^3.8.0",
    "react-native-contacts": "^5.0.6",
    "react-native-device-info": "^4.0.1",
    "react-native-gesture-handler": …
Run Code Online (Sandbox Code Playgroud)

android android-studio android-gradle-plugin react-native

20
推荐指数
4
解决办法
2万
查看次数