Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
    Ricardo Dias
    @slowdata
    so dumb..
    thkx Segei
    Ricardo Dias
    @slowdata
    Sergei can you help me with a file problem. I uploaded a csv file and it was ok. Tried with a ZIP file and when i wen't to download it it doesn't open. How can i read the file so it is in the original state.
    So when i download the file it opens nicelly
    Sergei Sergeev
    @s-KaiNet
    it depends how you read a file. Something below should work:
    var file = fs.readFileSync("path to the file")
    spr.post(url, {
     body: file,
    .....
    }
    Ricardo Dias
    @slowdata
    Thats how I made it. My zip is 10k when downloaded is 35k does not open
    const file = await fs.readFile(path.resolve(__dirname, fileName)
    const r = await spr.post(uri, {
    body: file,
    headers: {
    "X-RequestDigest": digest,
    "X-HTTP-Method": "POST",
    "IF-MATCH": "*",
    },
    });
    Sergei Sergeev
    @s-KaiNet
    strange... if you try any other binary file, say image, does it work?
    Ricardo Dias
    @slowdata
    1m.. testing it
    used png file. From 31k whent 105k and it opens with nothins
    Windows 10 image vier says: It looks like we don't support this file format
    Sergei Sergeev
    @s-KaiNet
    you use await fs.readFile - are you sure, that fs.readFile returns a promise?
    Ricardo Dias
    @slowdata
    const fs = require("fs").promises;
    should it be a stream and not a buffer?
    Sergei Sergeev
    @s-KaiNet
    ah... ok
    basically buffer should work
    Ricardo Dias
    @slowdata
    I doesn't
    it
    am I missing some header?
    Sergei Sergeev
    @s-KaiNet
    but just to be sure, try saving the file into the local file system and check if you can open it
    Ricardo Dias
    @slowdata
    I rhight clicked the link. Saved the file and it doesn't work
      const file = await fs.readFile(path.resolve(__dirname, fileName), {
        encoding: null,
      });
    Sergei Sergeev
    @s-KaiNet
    I mean try read the file with fs.readFile and then save it with fs to local file system, in your node app
    Ricardo Dias
    @slowdata
    ok
    It works fine
    from vpn.png and made coisas.png and it opens perfectly
    so it's the api call or sharepoint!?!?!
    Sergei Sergeev
    @s-KaiNet
    yep, it looks like smth is wrong with api call
    try to add json: false to the list of request parameter, i.e.
    const r = await spr.post(uri, {
        body: f,
        json: false,
        headers: {
          "X-RequestDigest": digest,
          "X-HTTP-Method": "POST",
          "IF-MATCH": "*",
          "Content-Length": f.length,
        },
      });
    Ricardo Dias
    @slowdata
    Corret!!!!!!
    Bingo
    Thkkx once again.
    Sergei Sergeev
    @s-KaiNet
    cool! :)
    Ricardo Dias
    @slowdata
    I will need to buy you a beer!! :)
    To you and Andrew
    Sergei Sergeev
    @s-KaiNet
    no problem :)
    I will write to you, when I next time be in Portugal :)
    Ricardo Dias
    @slowdata
    Please do it!!
    If we survive this shit!!
    Sergei Sergeev
    @s-KaiNet
    oh yehh..
    Zach Rachedi
    @Shisuki
    Hey guys, anyone here can point me to the right direction to set up an existing Sharepoint Online project with Webpack ?
    Andrew Koltyakov
    @koltyakov
    Hey @Shisuki, can you elaborate? SPFx already has embed webpack config. What's the "existing SharePoint Online project"?
    Zach Rachedi
    @Shisuki

    Hey @koltyakov, I'm new to sharepoint and recently jointed a team that uses Sharepoint Online on a client's website. They were programming using Sharepoint Designer 2013, I introduced VS Code with SPGo and things are a bit better since we can publish work directly from VsCode now, but things still need improvements since there's a LOT of duplicate code between pages in /SitePages and they're using plain Javascript.

    I want to introduce Typescript and some modularity into the project, I figured using WebPack is a way to start

    Andrew Koltyakov
    @koltyakov
    So it’s SharePoint Online but still classic pages. Well, on the long run it’s better invest into learning SPFx (mostly just the ordinary front end dev with a couple of nuances) and Modern Sites. To switch to more robust SharePoint aware build system as a pre-spfx step I can suggest SPPP generator. It’s for classic SharePoint. We still use it with On-Prem projects.
    Zach Rachedi
    @Shisuki
    Thanks for the quick reply!
    As i said tho I'm still really new to Sharepoint, can I use the PPP generator to slowly refactor the existing website ?
    Andrew Koltyakov
    @koltyakov
    Yes, you can. One of its actions is just in case pulling existing assets from SP site. Though it’s a very old approach. And I’d better recommend never treating ./dist folder as something stored in git rather than a temporary folder for built assets only.
    Another approach is to grab some configs as an example.
    Zach Rachedi
    @Shisuki
    Thank you! I'll try following your Wiki and build something small with it and see. Can you point me to some ressources to learn that ? I want to create a few test pages on my local machine, have them use a few node libraries and have them share some custom modules all in Typescript and publish everything in SPO so I can show my coworkers some proof of concept before they let me mess around with a big refactor