微信小程序 云存储 wx.cloud.downloadFile 下载并另存

《微信小程序开发从入门到实战》学习四十三 (实际运行的时候,success写错了,写成了sucess,改正后,提示我wx.saveFile快过时了,要换成wx.getFileSystemManager().saveFile,最后运行完调试台输出文件路径是临时url,担心永久存储了文件,现在又找不到文件位置,删不掉,多下几次内存会不会爆,瑟瑟发抖 ,先这样,以后有时间再找找)在调试台的打印输出那里,打印完进度条后是下载的文件的临时url,点开可以看到图片,在电脑里实在找不到下载文件的文件路径,至少我目前暂时找不到) 阅读详情
var result = await wx.cloud.downloadFile({fileID: cloudPath})
if (result.statusCode == 200) {
    wx.getFileSystemManager().saveFile({
        tempFilePath: result.tempFilePath, // 传入一个本地临时文件路径, http://tmp/开头的
        filePath: wx.env.USER_DATA_PATH + '/abc', //保存到用户目录/abc文件中,此处文件名自定义,因为tempFilePath对应的是一大长串字符
        success(res) {
          console.log('save ->', res) // res.savedFilePath 为一个本地缓存文件路径
          wx.showToast({
            title: '文件已保存至:' + res.savedFilePath,
            icon: 'none',
            duration: 1500
          })
        }
      })
}

微信开发者工具(v1.02.1907300)上,wx.env.USER_DATA_PATH对应:C:\Users\tom\AppData\Local\微信开发者工具\User Data\WeappFileSystem\(一串字符可能是开发者工具标识)\(模拟器标识)

模拟器上:通过chooseImage等方法选择的本地文件会返回一个http:/tmp/xxxx.xxxx....的文件,对应此处tmp文件夹内的文件,通过FileSyste

微信小程序:wx.cloud.downloadFile中的fileID的修改,点击不同名称对应下载打开不同的pdf 如图,点击不同文件,下载打开不同的pdf 通过观察可以发现:同一个云开发的环境id,在上传文件时,文件的fileID几乎相同,如下。 而’cloud://math****-1301276362/'后面的跟的都是文件上传之前的命名,即下面两个文件上传时的名称分别为“1.pdf”、“2.pdf” cloud://math****-1301276362/1.pdf cloud://math****... 阅读详情

相关推荐

微信小程序从云数据库中下载文件重命名并保存到手机

下载wx.cloud.downloadFile 保存并重命名wx.getFileSystemManager().saveFile,此时保存到微信固定的文件夹,手机端很不友好,这一步骤重点是利用filePath重命名如下filePath: wx.env.USER_DATA_PATH + "/" + '保存文件的名字' + '.保存文件的格式', wx.getFileSystemManager().saveFile({ tempFilePath: sres.tempFilePath, // 传入一个本地.

Edith的博客 3559

微信小程序上传图片到云开发控制台存储及从储存下载图片到本地相册全流程

一、选择图片 chooseImage: function (e) { var that = this; wx.chooseImage({ sizeType: ['original', 'compressed'], // 可以指定是原图还是压缩图,默认二者都有 sourceType: ['album', 'camera'], // 可以指定来源是相册还是相机,默认二者都有 success: function (res) { consol

qq_20411471的博客 4038

10分钟精通微信小程序 | 光速入门【三】

###云数据库 一:查询云数据库中的数据 // 1. 获取数据库引用 const db = wx.cloud.database() // 2. 构造查询语句 // collection 方法获取一个集合的引用 // where 方法传入一个对象,数据库返回集合中字段等于指定值的 JSON 文档。API 也支持高级的查询条件(比如大于、小于、in 等),具体见文档查看支持列表 // get 方法会...

不知火猪 727

Qwen2.5-VL模型微调实战:从零到部署的完整流程(附避坑指南)

本文详细介绍了Qwen2.5-VL视觉语言模型从零开始的完整微调与部署流程。内容涵盖使用LLaMA-Factory进行LoRA微调的关键参数配置与避坑指南,以及如何将训练好的模型权重合并,并最终利用vLLM高性能推理引擎进行部署,为开发者提供了一套可落地的实战方案。

oo7890的博客 595

用例设计:滴滴打车从轿车到完成支付如何测?

滴滴打车全流程测试用例设计从业务场景覆盖、功能逻辑分解、异常流验证三个维度展开,系统化地构建了测试方案。首先,业务流主干场景被分解为叫车、行程中、支付结算三个阶段,每个阶段都设计了核心测试用例,包括正向和异常用例,如定位准确性、车型选择逻辑、路径偏移监控、费用实时计算、多支付方式兼容等。专项测试补充了状态机验证、资损防控测试和性能测试,确保系统在不同情况下的稳定性和安全性。测试数据策略采用等价类划分设计,实战技巧包括流量回放技术、混沌工程注入和计费沙盒验证,以提高测试的覆盖率和准确性。最终输出交付物包括流程

海姐软件测试的博客 1529

ABAP代码使用OAuth2.0 Client Credential调用外部API

ABAP-OAuth2.0-调用外部API

m0_74015269的博客 1962

SAP采购信息记录批量维护实战:用BAPI ME_INFORECORD_MAINTAIN搞定价格等级和条件记录

本文深入解析SAP标准BAPI ME_INFORECORD_MAINTAIN在采购信息记录批量维护中的应用,特别聚焦价格等级和条件记录的技术难点。通过实战案例和代码示例,帮助用户高效处理供应商-物料价格数据,提升供应链管理效率。

weixin_42522320的博客 414

Windows Server上OpenVPN 2.4.8双因子认证实战:账号密码+证书,附一键脚本

本文详细介绍了在Windows Server上部署OpenVPN 2.4.8双因子认证(账号密码+证书)的实战方案,包括架构设计、证书体系规划、环境准备、服务器端配置及客户端自动化部署。通过一键脚本和优化配置,提升企业VPN的安全性和运维效率,特别适合金融、医疗等对安全性要求高的行业。

weixin_29231221的博客 473

Moveit Servo学习

MoveIt Servo功能与配置指南 摘要:本文介绍了MoveIt Servo的功能特性,包括支持关节速度、末端执行器速度和位置控制,以及安全功能如奇点检查、碰撞检测等。通过示例展示了如何运行伺服控制demo,详细解析了关键节点和话题。最后以睿尔曼rml_63机器人为例,讲解了如何自定义伺服配置文件,包括环境设置、输入输出参数配置、平滑滤波器和规划场景监控等关键配置项。文章提供了从基础使用到自定义机器人配置的完整指导,帮助开发者实现高效的实时运动控制。

Fisher的博客 1182

一周涨十万星,GitHub 爆火的 REA 逆向工程到底是什么?

REA 这波热度里,我一直没太想明白的是它为什么火在 AI 圈而不是安全圈。同类的 MCP 工具早就在了,技术上也谈不上新,真正变的只有一件事:门槛。门槛一降,参与的人就从"会逆向的工程师"变成了"会打字的任何人"。这大概也是争议的根源。护城河这件事,多数报道的共识是它从"你看不到我的代码"挪到了"你拿不走我的服务能力和业务理解"。这话对不对,现在没人拿得出证据,只能等下一批真实案例。哪天有人拿 REA 把某个还在卖钱的闭源软件啃出可维护的工程,那个答案才算落地。

CSDNzhizunbao的博客 1252

408 | 408常用计算公式与方法 —— 计组篇 汇总

408常用计算公式与方法 —— 计算机组成原理篇 汇总

"You are worthy! You can do it!" 4675

IDEA的使用指南

IDEA基于java的使用手册,可以最快速的上手,在使用中不断的丰富自己的使用技巧.

lwip-2.0.3

lwip是瑞典计算机科学院(SICS)的Adam Dunkels 开发的一个小型开源的TCP/IP协议栈。实现的重点是在保持TCP协议主要功能的基础上减少对RAM 的占用。

Data-Structures-and-Algorithm-Analysis-in-Java.pdf

作者: Weiss, Mark A. 出版社: Addison Wesley Data Structures and Algorithm Analysis in Java is an “advanced algorithms” book that fits between traditional CS2 and Algorithms Analysis courses. In the old ACM Curriculum Guidelines, this course was known as CS7. This text is for readers who want to learn good programming and algorithm analysis skills simultaneously so that they can develop such programs with the maximum amo...

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

上一篇: CentOS 6 卸载erlang
下一篇: rabbitmqctl (escript: exception error: undefined function rabbitmqctl_escript:main/1)
mcatto
博客等级 码龄15年 87粉丝 205原创
评论 4
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值