如何在无服务器环境下拆分表单数据



im获取event.body中的表单数据,如下所示

{profileImage:'------WebKitFormBoundaryt2NUqsKdknDPfBB\r\n内容处置:表单数据;name="profileImage"\\r\n\r\n数据:image/jpeg;底座64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wCEAAkGBxISEhUTethIWFRUFRYWFhUWFxUXFxUVFRUFhUVFRcYHSgGBolHRUXITEhJSktLi4uFx8zODMtNytLisBCgoKDg0OGxAQGy0fHyUtMS0tLS0tLS01tLS0t LS0tls0tLS00tLS0Tls0tls00tLS01lLS0tLs0tLS08tLf/AABEIcBdgMBIgACEQEDEQH/xAAbAABBQEBAAAAAAAAAAAEAAIDBQYBB//EA EMQAAIBAgQEAYCCAMIAgMAAAECEQADBBIhMQUTIkEGMlEjYXGBkaEUsTNCUnLB0eHwJHOzBxU0Q1NigrKS8SWD0v/EABkBAAMBAEAAAAAAAAAAAAAAAECAwAEBf/EAC0RAAICAAQFAwQCAwEAAAAAAAABAhEDEiExIjJBcYETI2EzQpHwUdEEwfGx/9oADAMBAAIRAxEAPwDNWkqUW67bSPLWvYOKyNbdcuWZopRTslFAZVNhz6VwWqsrluouVV4sjLQFFupOTRC26nS3RFsFmCzVgtinjD0LNTK8WakWzRxw5FdFitZqYOgjtT4NFLh6lFikdDaglu3RCWZohEjtUwiKRsdAqQ2akze6umaWmbMgRlYU5ffRZ tyKjSySdBR0UDbQgdB6TUXJnYVaLge7GB/feiLaAeVY95/uTUJf5MY7alY4E5b6F2FIMER8feAR9iPrTuRW14xheZZw6wM3KzA7TlVJGvu/IVRfhYJB3BI+YMU2HjqcbExMLI6KprdN5NRTORVUyTK9bnELYmiVsVIFrNmTADbrgtEbNdFqtYAEWalXD0WLVOCVrMmDtYqBrNWfL0pow9BOjS1K3k0uRVsMOKRsjnFysqerXPw9WvIrvIrZgUVP4ekcPVt+HrhsVswaZTnD1G2Hq7OHpjYatmNlKjsNUD4er9NUD4ahmDRQvYod7FX1zDULDsUjY6RRvYpVYvYpVMoCK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OR941is7wywRib6swYgJJUFBqqnQTPf11rT+NVHKsyxUfiElgQpAyPJDHRfjWS8P5GxOJCPNCUDnLk9C5padequaSb0K4a1Lw5V00HuG5+Q3qMsewPz0H8/tl27bt6FlX3SB9qr7/GLY8uZvgIH31+1c7kludKTZsb5izYJWZS2pEnL1Pb6h6sO3z9azGMVAHNogqcRdz6AMLmYhlYeogfEZT3r4PEh8YYLrltqQToAxTUdifT+uua4gE6ikj292VYQ2fMc0+o2IpoQaDdwtE5K/5PMIEyNmMD Lqd9dgN+1XlnFLbRBka5cKyCoViNds+pHwiqbDOAjAKSYGyzA1nXt2+lW1jiLjaVLSZ5GpBYAERuInvuDVYCyW4R4dxjri7jNbuZjajIozMOq3EzAGg3NWVi6xxqMVKGNmIzCLbQdNB2NV3hLF3ExjlrZd2tEQUy6dVszNzYQN6ucUH/HoXQISGOUNBHUSY36ZoYj9t9wQXueDceHmMvzvmkt8lu3a

我想在数据的开始和结束处删除它。------WebKitFormBoundaryt2NUqsKdknDPFBB\r\n内容处置:表单数据;name="profileImage"\r

var text = `Your_Event_Data`
var newText = ''
newText = text.substring(text.indexOf('form-data')+9,text.length)
console.log(newText.indexOf('data'))
newText = newText.substring(newText.indexOf('data'),newText.length)
newText = newText.substring(0,newText.indexOf('WebKitFormBoundary')-7)

相关内容

  • 没有找到相关文章

最新更新